How to send sms,Email using java
how to send sms,Email using java
Hi,
There are many sms gateways that have their own api to send sms. You can use them for sms. (They will charge you for the sms!!!)
Moderator edit: Link removed
Thanks
Edited by: PhHein on 20.10.2010 16:11
Similar Messages
-
How to send secure email using JavaMail
Hi, anyone out there know how to send secure email using Java Mail? Greately appreciated.
For starters, if you have not already done so, read about it in the JavaMail design specifications.
Search for Message Security in the said document. -
How to send CC email using SO_DOCUMENT_SEND_API1
Hi,
How to send CC email using SO_DOCUMENT_SEND_API1. Any sample code is very much appreciated.
CheersPlease check In this function there is a flag in RECEIVERS table for sending mail as COPY or BLIND COPY
a® -
How to send an email using XML Publisher
Can any body help me how to send an email using XML Publisher.
Regards,
SureshSorry ,
when a http://blogs.oracle.com/xmlpublisher/newsItems/departments/documentDelivery
this it show this not answer the question.
Thanks
Welcome to Oracle Blogs
Welcome to the Oracle blogging community, where Oracle executives, employees, and non-employees exchange views about customer requirements and best practices.
We're sorry, the weblog you requested cannot be accessed.
- You may not have the necessary permission for access the weblog.
- This weblog does not exist.
You may wish to try again using one of the tools below.
- Check the URL and contact your System Administrator for access.
- Or click here to go back to Oracle Blogs homepage.
Powered by
Movable Type and Oracle
The views expressed on this blog are my own and do not necessarily reflect the views of Oracle. Terms of Use -
How to send SMS by using ABAP program
HI Gurus,
I need to notify the vendor through sms when his goods are received. His details are stored in vendor master.
My problem is that I am not able to find any function module for the same.
Do any of you know how to send 'sms' to particular mobile number using ABAP.
Are there any basis settings required for the same?
Thanks and Regards,
SaurabhHi,
Pls check the below links
http://help.sap.com/saphelp_nw04/helpdata/en/58/97c43af280463ee10000000a114084/frameset.htm
/people/ronen.fox/blog/2007/12/06/sending-sms-notification-via-business-workflow
http://www.****************/Tutorials/Workflow/Workflow.htm
You can use the FM: 'SO_DOCUMENT_SEND_API1' &
'SO_DOCUMENT_SEND_API1_NEW'.
to send the mail,sms etc.
But you have to make some chamnges in the reciever table, jus go thru FM documnetaion once, you will fine the option for sending SMS thru either of this FM.
Below is a sample code for sending e-mail.
so, u can take help from this.
data declarations
DATA : v_sender TYPE soextreci1-receiver,
v_doc TYPE sodocchgi1,
it_paklist TYPE STANDARD TABLE OF sopcklsti1 ,
wa_paklist TYPE sopcklsti1 ,
it_obj_head TYPE STANDARD TABLE OF solisti1 ,
it_obj_bin TYPE STANDARD TABLE OF solisti1 ,
it_obj_txt TYPE STANDARD TABLE OF solisti1 ,
it_obj_rcv TYPE STANDARD TABLE OF somlreci1 ,
wa_obj_rcv TYPE somlreci1 ,
v_desc(100).
CONSTANTS: c_start(12) TYPE c VALUE '000000000000001',
c_num(12) TYPE c VALUE '000000000000002',
c_num1(12) TYPE c VALUE '000000000010030',
c_raw(3) TYPE c VALUE 'RAW',
c_test(4) TYPE c VALUE 'TEST',
c_X(1) TYPE c VALUE 'X'.
refresh internal tables
REFRESH : it_paklist, it_obj_rcv.
clear internal tables
CLEAR : it_paklist, it_obj_rcv, v_sender.
v_sender = sy-uname.
fill internal table it_paklist
wa_paklist-head_start = c_start.
wa_paklist-head_num = c_num.
wa_paklist-body_start = c_start.
wa_paklist-body_num = c_num1.
wa_paklist-obj_name = c_test .
wa_paklist-doc_type = c_raw .
wa_paklist-transf_bin = c_X .
APPEND wa_paklist TO it_paklist.
clear: wa_paklist.
Data in the Header/subject Line
v_desc = text-005 .
v_doc-obj_name = c_objname .
v_doc-obj_descr = v_desc.
Mail text
APPEND v_desc TO it_obj_txt.
Preparing the receiver list
wa_obj_rcv-rec_type = 'U'.
wa_obj_rcv-rec_type = 'C'.
v_dlist = 'SCE_TEST'.
wa_obj_rcv-receiver = v_dlist. "Distribution list.
wa_obj_rcv-receiver = Enter the mail id .
APPEND wa_obj_rcv TO it_obj_rcv.
Call the function module to send mail
IF NOT it_obj_rcv[] IS INITIAL.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = v_doc
sender_address = v_sender
sender_address_type = 'B'
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_paklist
object_header = it_obj_head
contents_bin = it_obj_bin
contents_txt = it_obj_txt
receivers = it_obj_rcv
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc NE 0.
MESSAGE text-006 TYPE 'I' .
ENDIF.
ENDIF . -
Help Me! How to send sms from a java program with a pda connected to system
help me ,
I am new in JavaME. I have to send sms from a java program, A PDA is connect to the system. Can some one help me to make that program which interact with PDA connected to system and send sms to any mobile or pda phones.user12873853 wrote:
I believe JavaMail API will help in sending the mails and SMS through SMTP server. Sounds more like false hope than belief to me. The only way that would work is if you have an SMS gateway that allows communication through SMTP. Doubtlessly some exist (searching for 'JavaMail sms' through google certainly seems to indicate this), but if you have to ask you don't have one.
And that exactly where you are stuck: to send SMS messages you need an SMS gateway. That will be the first thing you have to shop for, until then there is no reason to think about code, protocols or implementations. It can be as simple as hooking up a mobile phone, but then you cannot send bulk messages of course. Most likely you'll need to shop around for a partner that has an SMS blasting service you can use. -
How to send Secured Mail using Java Mail?
I want to send mails with "Send Secure" option using Java Mail. Now mails are being sent using Java Mail connecting to smtp host.
Appreciating your help.
Thanks.There are third party libraries to help with this. Bouncy Castle is very popular.
See the [JavaMail Third Party Products|http://java.sun.com/products/javamail/Third_Party.html] page. -
How to send mail attachments using java mail
can any one help how to create mails attachments using java mail
you can do it like this:
Message msg = new MimeMessage(session);
String fileAttachment = "c:/test.txt";
Multipart mp = new MimeMultipart();
BodyPart bp = new MimeBodyPart();
FileDataSource fds = new FileDataSource(fileAttachment);
bp.setDataHandler(new DataHandler(fds));
bp.setFileName(fds.getName());
mp.addBodyPart(bp);
msg.setContent(mp);
... -
How to send php email using email from recordset?
Hi
I know the headers to use for php mail(), and I use it for
the contact form for my viewers in order to contact the directory
listing's email address ( of which I have hidden by using the words
'Email Us' and use the id to carry through to the form).
I have sucessfully used the $to = [email protected] but when I
want to use the $row_?['email'] it will not send.
Any suggestions? I use a recordset to retrieve the id of the
listing to the contact form.
I will want to follow the same procedure for my jobseekers to
contact employers job adverts.
Thanks
TheresaHi,
There are many sms gateways that have their own api to send sms. You can use them for sms. (They will charge you for the sms!!!)
Moderator edit: Link removed
Thanks
Edited by: PhHein on 20.10.2010 16:11 -
Problem in sending SMS via using java communication API
I need to send SMS via my sony ericsson Z530i. It is connected to the com5 port of my system. I got the following code.
import java.io.*;
import java.util.BitSet;
import javax.comm.*;
import java.lang.*;
public class SerialToGsm {
InputStream in;
OutputStream out;
String lastIndexRead;
String senderNum;
String smsMsg;
SerialToGsm(String porta) {
try {
// CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier("com5");
CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(porta);
SerialPort sp = (SerialPort)portId.open("Sms_GSM", 0);
sp.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
sp.setFlowControlMode(sp.FLOWCONTROL_NONE);
in = sp.getInputStream();
out = sp.getOutputStream();
// modem reset
sendAndRecv("+++AT", 30); // delay for 20 sec/10
sendAndRecv("AT&F", 30);
sendAndRecv("ATE0", 30); // echo off
sendAndRecv("AT +CMEE=1", 30); // verbose error messages
sendAndRecv("AT+CMGF=0", 70); // set pdu mode
// sendAndRecv("AT V1E0S0=0&D2&C1", 1000000);
catch (Exception e) {
System.out.println("Exception " + e);
System.exit(1);
private String sendAndRecv(String s, int timeout) {
try {
// clean serial port input buffer
in.skip(in.available());
System.out.println("=> " + s);
s = s + "\r"; // add CR
out.write(s.getBytes());
out.flush();
String strIn = new String();
for (int i = 0; i < timeout; i++){
int numChars = in.available();
if (numChars > 0) {
byte[] bb = new byte[numChars];
in.read(bb,0,numChars);
strIn += new String(bb);
// start exit conditions
if (strIn.indexOf(">\r\n") != -1) {
break;
if (strIn.indexOf("OK\r\n") != -1){
break;
if (strIn.indexOf("ERROR") != -1) { // if find 'error' wait for CR+LF
if (strIn.indexOf("\r\n",strIn.indexOf("ERROR") + 1) != -1) {
break;
Thread.sleep(100); // delay 1/10 sec
System.out.println("<= " + strIn);
if (strIn.length() == 0) {
return "ERROR: len 0";
return strIn;
catch (Exception e) {
System.out.println("send e recv Exception " + e);
return "ERROR: send e recv Exception";
public String sendSms (String numToSend, String whatToSend) {
ComputeSmsData sms = new ComputeSmsData();
sms.setAsciiTxt(whatToSend);
sms.setTelNum(numToSend);
// sms.setSMSCTelNum("+393359609600"); // SC fixed
String s = new String();
s = sendAndRecv("AT+CMGS=" + (sms.getCompletePduData().length() / 2) + "\r", 30);
// System.out.println("==> AT+CMGS=" + (sms.getCompletePduData().length() / 2));
// System.out.println("<== " + s);
if (s.indexOf(">") != -1) {
// s = sendAndRecv(sms.getSMSCPduData() + sms.getCompletePduData() + "\u001A"); // usefull one day?
// System.out.println("Inviero questo >>>> " + sms.getCompletePduData());
// if this sintax won't work try remove 00 prefix
s = sendAndRecv("00" + sms.getCompletePduData() + "\u001A", 150);
// System.out.println("<== " + s);
return s;
else {
return "ERROR";
// used to reset message data
private void resetGsmObj() {
lastIndexRead = null;
senderNum = null;
smsMsg = null;
public String checkSms (){
String str = new String();
String strGsm = new String();
strGsm = sendAndRecv("AT+CMGL=0", 30); // list unread msg and sign them as read
// if answer contain ERROR then ERROR
if (strGsm.indexOf("ERROR") != -1) {
resetGsmObj();
return strGsm; // error
strGsm = sendAndRecv("AT+CMGL=1", 30); // list read msg
// if answer contain ERROR then ERROR
if (strGsm.indexOf("ERROR") != -1) {
resetGsmObj();
return strGsm; // error
// evaluate message index
if (strGsm.indexOf(':') <= 0) {
resetGsmObj();
return ("ERROR unexpected answer");
str = strGsm.substring(strGsm.indexOf(':') + 1,strGsm.indexOf(','));
str = str.trim(); // remove white spaces
// System.out.println("Index: " + str);
lastIndexRead = str;
// find message string
// look for start point (search \r, then skip \n, add and one more for right char
int startPoint = strGsm.indexOf("\r",(strGsm.indexOf(":") + 1)) + 2;
int endPoint = strGsm.indexOf("\r",startPoint + 1);
if (endPoint == -1) {
// only one message
endPoint = strGsm.length();
// extract string
str = strGsm.substring(startPoint, endPoint);
System.out.println("String to be decoded :" + str);
ComputeSmsData sms = new ComputeSmsData();
sms.setRcvdPdu(str);
// SMSCNum = new String(sms.getRcvdPduSMSC());
senderNum = new String(sms.getRcvdSenderNumber());
smsMsg = new String(sms.getRcvdPduTxt());
System.out.println("SMSC number: " + sms.getRcvdPduSMSC());
System.out.println("Sender number: " + sms.getRcvdSenderNumber());
System.out.println("Message: " + sms.getRcvdPduTxt());
return "OK";
public String readSmsSender() {
return senderNum;
public String readSms() {
return smsMsg;
public String delSms() {
if (lastIndexRead != "") {
return sendAndRecv("AT+CMGD=" + lastIndexRead, 30);
return ("ERROR");
}When i compile, there is no error. But when i execute it, the following error comes:
E:\java\JavaSmsApi>javac SerialToGsm.java
E:\java\JavaSmsApi>java SerialToGsm
Exception in thread "main" java.lang.NoSuchMethodError: main
What might be the error? Somebody help me. Thanks in advance.You are probably trying to run this as a CLDC application instead of a MIDP application (aka a MIDLet). Since CLDC apps start with a main(....) your runtime looks for one but does not find it, hence the error. Please recheck the project configuration.
-
How to send e-mail using java mail api
Hi can anyone tell me how to send mail using the javamail api, in short if possible an example code.
Theres already lots of this code in the forums, use the search bar to the left.
Also, there is a dedicated javaMail forum which you will find useful (you are currently in a JSP forum)
http://forum.java.sun.com/forum.jspa?forumID=43 -
How to send an Email using SMTPSSLTranport of JavaMail
Hi,
Provide me any sample code to send the mail using SMTPSSLTransport of JavaMail.
Thanks,Sujata.is it something like that you want :
(you can fin a similar answer in many places, even in this forum...)
// mail session;
Session mailSession;
// set properties for appropriate server
Properties props = new Properties();
props.put("mail.smtp.host", strServer);
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
// uncomment for debug
// props.put("mail.debug", "true");
mailSession = Session.getInstance(props, new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(strLogin, strPassword);}});
// prepare message
Message message= new MimeMessage(mailSession);
InternetAddress[] arrToAddress = {new InternetAddress(strTo)};
message.setRecipients(Message.RecipientType.TO, arrToAddress);
InternetAddress fromAddress = new InternetAddress(strFrom);
message.setFrom( fromAddress );
message.setSubject( strSubject);
message.setText( strMessage );
message.setSentDate((Calendar.getInstance()).getTime());
message.setHeader(Constants.PROXYMAIL_ERROR_OK, "JavaMail");
// Send our mail message
Transport.send(message); -
How to send HTML email using alert framework? Kindly help!
Hi Experts,
I am using alert framework (alert category) to send email. In the email message I want to use HTML content along with some hyperlinks.
How can I do this?
kindly help!
Thanks
Gopal
Message was edited by:
gopalkrishna baligaHi,
To send hyper links, you can add the links in the FollowUp Activity.
The content of the mail from the alert framework will be a text mail.
One option would be to check in your SCOT settings if it would be possible to set the Content Type as TEXT/HTML . If yes, then maybe this should be possible.
Regards
Bhavesh -
How to Send Html Email using JavaMail?
I want to send email message body as html.
as some news sites send.What will easiest way of doing that?oops!!!
Sorry there is one more thing in it the ByteArrayDataSource class. I am posting the code in the class here. Compile it in a separate class.
class ByteArrayDataSource implements DataSource
private byte[] data; // data
private String type; // content-type
/* Create a DataSource from an input stream */
public ByteArrayDataSource(InputStream is, String type)
this.type = type;
try
ByteArrayOutputStream os = new ByteArrayOutputStream();
int ch;
while ((ch = is.read()) != -1)
// XXX - must be made more efficient by
// doing buffered reads, rather than one byte reads
os.write(ch);
data = os.toByteArray();
} catch (IOException ioex) { }
/* Create a DataSource from a byte array */
public ByteArrayDataSource(byte[] data, String type)
this.data = data;
this.type = type;
/* Create a DataSource from a String */
public ByteArrayDataSource(String data, String type)
try
// Assumption that the string contains only ASCII
// characters! Otherwise just pass a charset into this
// constructor and use it in getBytes()
this.data = data.getBytes("iso-8859-1");
catch (UnsupportedEncodingException uex)
this.type = type;
* Return an InputStream for the data.
* Note - a new stream must be returned each time.
public InputStream getInputStream() throws IOException
if (data == null)
throw new IOException("no data");
return new ByteArrayInputStream(data);
public OutputStream getOutputStream() throws IOException
throw new IOException("cannot do this");
public String getContentType()
return type;
public String getName()
return "dummy";
}hope this will help
best wishes
khuda hafiz -
How to receive HTML email using JAVA Mail API?
Hello!
I am developing WEB Mail System. There is a little problem. I am unable to receive mail in HTML format. The mail is being received in only text format currently. What method do i need to use to achieve this functionality currently i am using
MimeMessage message = mail.getMessage();
if(message.isMimeType("text/plain")){
String str_message_body = message.getContent().toString();
else
Multipart multipart = (Multipart)message .getContent();
Kindly advise me regarding that because i am in a state of fix right now and unable to proceed further.
I will really appreciate a prompt response from you.
Regards,
Burhan Ramay.HTML is a text format too, so you do
if(message.isMimeType("text/html")){
String str_message_body = message.getContent().toString();
}
Maybe you are looking for
-
Adobe After Effects Cs6 Installation Error. HELP!
When i do my installation of Adobe After effects cs6, i install as trial version, because i want to see what it is like, and i do everything like everyone says, and then it stops at 2 percent saying Installation Failed and it comes up with these solu
-
AppleTV as second display for Macbook
Hello! I just received a new Apple TV (2nd Gen) as a gift. I like to use the Macbook to stream online content (i.e. football games, Hulu). I connect my computer to our 27" television and use the TV as a second monitor. The issue: My TV has one HDMI p
-
A strange error in Safari...
Hello I wish ask for a little help, I have tried to go to a site where I want to sell my G5. On that site there is this place called Market, and they have all kinds of links to product people sell. I wanted to sell my mac there. But to my amazement I
-
Best way to deal with AVI clips taken with stills cam?
we have a nikon S70 consumer camera which also takes video clips; these clips are .AVI format. I thought it would be smart to convert them to QT format, but a 1.5GB clip became a 38-GB monster! What would be the best way to get these .avi clips into
-
Two problems that bother me now. Can I buy an unlocked blackberry classic from Verizon? Can I use it on China Mobile GSM carrier if I could buy? thanks