on 05-12-2007 7:20 AM
Hi Experts,
I am trying to execute a webdynpro application which uses the Java Mail API to send emails. The exception that I get on executing the application is :
Sending failed; nested exception is: javax.mail.SendFailedException: Invalid Addresses; nested exception is: javax.mail.SendFailedException: 550 5.7.1 Unable to relay for it@otegroup.com
Can anybody please help me sort out the issue.
Regards
Abdullah
Hi ismail
To send Email from webdynpro the mail server port must be enabled.Make sure the host IP Address,port and protocol is corrct in your coding.
Can you send yourcode so that i will see wheich line is exact error.
regards
kalyan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Venkat
I am trying out the tutorial available on SDN. The following is the code snippet of the wdDoInit and one of the action handlers
Send View
public void wdDoInit()
{
//@@begin wdDoInit()
// @TODO Enter your email address for the setFrom and setTo methods by replacing the text in angle brackets.
wdContext.currentEmailElement().setFrom("oteportal@otemail.otegroup.com");
wdContext.currentEmailElement().setTo("it@otegroup.com");
wdContext.currentEmailElement().setCc("");
wdContext.currentEmailElement().setBcc("");
wdContext.currentEmailElement().setSubject("Travel Request Form");
wdContext.currentEmailElement().setBody("You will find the requested Travel Request Form in the attachment of this email. Please fill out this form and send it back. nnYour Travel Management Team");
//@@end
}
public void onActionSendForm(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionSendForm(ServerEvent)
Properties props = new Properties();
String host = "otemail.otegroup.com";
props.put("otemail.otegroup.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
{
MimeMultipart multipart = new MimeMultipart();
BodyPart messageBodyPart = new MimeBodyPart();
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);
messageBodyPart = new MimeBodyPart();
String filename = "temp\webdynpro\web\local\TutWD_EmailInteractiveForm\
Components\com.sap.tut.wd.emailinteractiveform.EmailInteractiveFormComp\TravelRequest.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 (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();
}
//@@end
}
Regards
Abdullah
Abdullah,
Run Visual Administrator and check related settings of SAP WebAS (Services -> JavaMail or similar). Sounds like your WebAS is running on Li-/Unix and the default settings are set to localhost with non-configured relay. You should use some real SMTP/POP3 server host name instead.
Valery Silaev
SaM Solutions
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.