Thread View: borland.public.jbuilder.java.api
2 messages
2 total messages
Started by Bartek / Prao hos DataPartner AB
Mon, 03 Feb 2003 11:36
Problem with Javamail!!
Author: Bartek / Prao hos DataPartner AB
Date: Mon, 03 Feb 2003 11:36
Date: Mon, 03 Feb 2003 11:36
41 lines
2392 bytes
2392 bytes
It's like this, i have a problem when I'm trying to send a mail. I can only
send mail to an adress that's on the mailserver i have writen in the source
code. If i try to send a mail to an adress that's not located at the
mailserver I get this error:
javax.servlet.ServletException: Sending failed;
nested exception is:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
javax.mail.SendFailedException: 550 5.7.1 Unable to relay for
b2b01bo17@studentmail.ec.se
Howcome can't I send mail to whatever adress i want??
This is my sourcecode:
Properties props = new Properties();
props.put("mail.smtp.host", "themailserver.com");
Session s = Session.getInstance(props,null);
MimeMessage message = new MimeMessage(s);
InternetAddress from = new InternetAddress(mrBean.getUser());
message.setFrom(from);
String toAddress = email;
InternetAddress to = new InternetAddress(toAddress);
message.addRecipient(Message.RecipientType.TO, to);
String subject = help;
message.setSubject(subject);
String kundnr = request.getParameter("kundnr");
String datum = request.getParameter("datum");
String radio = request.getParameter("radio");
String rubrik = request.getParameter("rubrik");
String uppdrag = request.getParameter("uppdrag");
message.setText("Kundnr: " +kundnr+"\nDatum: "+datum+"\nPrioritet:
"+radio+"\nRubrik: "+rubrik+"\nUppdrag: "+uppdrag);
Transport.send(message);
Thanx in advance!
Re: Problem with Javamail!!
Author: Owen Green
Date: Mon, 03 Feb 2003 12:27
Date: Mon, 03 Feb 2003 12:27
20 lines
1708 bytes
1708 bytes
"Bartek / Prao hos DataPartner AB" <prao1@dpab.net> wrote in message news:3e3e5447@newsgroups.borland.com... > It's like this, i have a problem when I'm trying to send a mail. I can only > send mail to an adress that's on the mailserver i have writen in the source > code. If i try to send a mail to an adress that's not located at the > mailserver I get this error: > Sounds to me like the SMTP server is unwilling to relay the message for you. There are two obvious reasons (and probably a host of not so obvious ones :) - The SMTP server doesn't like the From address you've used (e.g it's configured only to relay mail from its own domain) - It can't find an MX record for the reciepient. Anyway, looks like an issue with the SMTP server and not JavaMail. hth Owen
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads