on 10-17-2006 9:56 AM
Hi,
Can anyone send the code for sending mails from webdynpro (JAVA) APPLICATION using JAVA API .. ?
Hi,
You can use this following code.
import javax.mail.*;
import java.util.*;
import javax.mail.internet.*;
class Mail
{
public static void main(String s[])
{
Session ses=null;
Message msg=null;
try
{
Properties p=System.getProperties();
//Properties p=new Properties();
p.put("mail.smtp.host","host");
p.put("mail.transport.protocol","smtp");
p.put("mail.smtp.auth","false");
p.put ("mail.smtp.port", "25");
boolean sessionDebug=true;
Authenticator a=new Auth("usr","pwde");
ses=Session.getInstance(p,a);
ses.setDebug(sessionDebug);
msg=new MimeMessage(ses);
msg.setFrom(new InternetAddress("fahadibm@gmail.com"));
(Message.RecipientType.TO,address[0]); msg.setRecipient(Message.RecipientType.TO,new InternetAddress("imran@abc.com"));
msg.setSubject("Test");
msg.setSentDate(new Date());
msg.setText("This is a Test");
}
catch(Exception e)
{
System.out.println("E1"+e);
}
try
{
Transport.send(msg);
}
catch(Exception e)
{
System.out.println("Exception is"+e);
}
}
}
class Auth extends Authenticator
{
String name;
String pwd;
public Auth(String name,String pwd)
{
this.name=name;
this.pwd=pwd;
}
public PasswordAuthentication getAuthenticate()
{
return new PasswordAuthentication(name,pwd);
}
}
For more info, go thru these links.
/thread/25456 [original link is broken]
Regards,
Sridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Refer this link
http://help.sap.com/saphelp_nw04/helpdata/en/91/9c2226df76f64fa7783dcaa4534395/frameset.htm
Regards,
Saraswathi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.