on 03-29-2008 7:12 AM
hi Experts,
I have created an email WD Java Application, this application sends an email to the users on click of a button.
My Problem is this application runs well on SP11, but we have upgraded our dev portal to SP14.
On SP14 mail is not send. Please help its really very urgent.
I am pasting the code used for sending email.
wdContext.currentEmailElement().setFrom(wdContext.currentContextElement().getEmpMailID());
wdContext.currentEmailElement().setCc("");
wdContext.currentEmailElement().setBcc("");
wdContext.currentEmailElement().setSubject("Personal Travel Request.");
wdContext.currentEmailElement().setTo("corporatetravel.booking@zmail.ril.com");
Properties props = new Properties();
String host = "rmail070.zmail.ril.com";
props.put("rmail070.zmail.ril.com", host);
Session session = Session.getInstance(props, null);
MimeMessage message = new MimeMessage(session);
Address toAddress = new InternetAddress();
Address fromAddress = new InternetAddress();
Address ccAddress = new InternetAddress();
Address bccAddress = new InternetAddress();
try
{
/* Creates an email object with different parts, one for the
text and another for the attached file */
MimeMultipart multipart = new MimeMultipart();
BodyPart messageBodyPart = new MimeBodyPart();
/* the following statements build up the email */
if (! wdContext.currentEmailElement().getFrom().equals(""))
{
fromAddress = new InternetAddress(wdContext.currentEmailElement().getFrom());
message.setFrom(fromAddress);
} if (! wdContext.currentEmailElement().getTo().equals(""))
{
toAddress = new InternetAddress(wdContext.currentEmailElement().getTo());
message.setRecipient(Message.RecipientType.TO,toAddress);
}
if (! wdContext.currentEmailElement().getCc().equals(""))
{
ccAddress = new InternetAddress(wdContext.currentEmailElement().getCc());
message.setRecipient(Message.RecipientType.CC,ccAddress);
}
if (! wdContext.currentEmailElement().getBcc().equals(""))
{
bccAddress = new InternetAddress(wdContext.currentEmailElement().getBcc());
message.setRecipient(Message.RecipientType.BCC,bccAddress);
}
if (!wdContext.currentEmailElement().getSubject().equals(""))
{
message.setSubject(wdContext.currentEmailElement().getSubject());
}
if (! wdContext.currentEmailElement().getBody().equals(""))
{
messageBodyPart.setText(wdContext.currentEmailElement().getBody());
}
multipart.addBodyPart(messageBodyPart);
/* a new part will be added, in the complete email this will
be the attachment */
messageBodyPart = new MimeBodyPart();
// try{
// String filename =WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(),"test.pdf");
// DataSource source = new FileDataSource(filename);
// messageBodyPart.setDataHandler(new DataHandler(source));
// messageBodyPart.setFileName(source.getName());
// messageBodyPart.setHeader("Content-Type","application/pdf");
// multipart.addBodyPart(messageBodyPart);
message.setContent(multipart);
Transport.send(message);
// }
// catch(WDAliasResolvingException e)
// {
// e.getMessage();
// }
}
catch (AddressException e)
{
wdComponentAPI.getMessageManager().reportWarning(e.
getLocalizedMessage());
e.printStackTrace();
}
catch (SendFailedException e)
{
wdComponentAPI.getMessageManager().reportWarning(e.getLocalizedMessage());
e.printStackTrace();
}
catch (MessagingException e)
{
wdComponentAPI.getMessageManager().reportWarning(e.getLocalizedMessage());
e.printStackTrace();
}
Points will be rewarded to helpful answers.
Regards,
Sanjyoti.
Hi,
see this link it will be helpful for u
[http://help.sap.com/saphelp_nw04/helpdata/en/f7/f289c67c759a41b570890c62a03519/content.htm|http://help.sap.com/saphelp_nw04/helpdata/en/f7/f289c67c759a41b570890c62a03519/content.htm]
regards
Hazrath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.