Hi Experts,
I want to send the email throw my webdynpro application.i am using this code.
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
public class Mailer
{
public String to,from,subj,mess,cc;
public boolean retrcpt;
private Logger log;
public Mailer()
{
to="";
from="";
subj="";
mess="";
cc="";
retrcpt=false;
log=new Logger();
}
public boolean doMail()
{
try
{
Properties props = System.getProperties();
props.put("mail.smtp.host", "160.84.32.6");
Session s = Session.getDefaultInstance(props, null);
s.setDebug(true);
Message msg = new MimeMessage(s);
msg.setFrom(new InternetAddress(from));
msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to, false));
if(cc!=null)
msg.setRecipients(Message.RecipientType.CC,InternetAddress.parse(cc, false));
msg.setSubject(subj);
msg.setText(mess);
if(retrcpt) msg.setHeader("Disposition-Notification-To",""+to);
Transport.send(msg);
return true;
}
catch(Exception e)
{
log.errLog("Exception while sending mail to "to" by "from" * "+e.toString());
return false;
}
}
}
My problem is that
ℹ️ Where to download the "import javax.mail.*;"file and where and how to install it.
(ii)And also tell me how to configer the SMTP server for the above need.
Advance Thanx