Article View: borland.public.jbuilder.java.api
Article #683Problem with Javamail!!
From: 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!
Technical Details
Message-ID:
<3e3e5447@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!easynet-quince!easynet.net!newsfeed.hostname.nl!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,f1f1dbef7e58d0b4,start X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2003-02-03 03:39:52 PST From: "Bartek / Prao hos DataPartner AB" <prao1@dpab.net> Newsgroups: borland.public.jbuilder.java.api Subject: Problem with Javamail!! Date: Mon, 3 Feb 2003 12:36:38 +0100 Lines: 43 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 213.204.174.92 Message-ID: <3e3e5447@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1044272199 213.204.174.92 (3 Feb 2003 03:36:39 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!easynet-quince!easynet.net!newsfeed.hostname.nl!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail