problem on sending email
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Peter_Lee
Posted On:   Saturday, December 28, 2002 08:43 PM

Java Mail hi, I'm new to JavaMail, I have a problem on my 1st JavaMail jsp, anyone can help me pls? below is the jsp: <%@ page contentType="text/html" import="javax.mail.*, java.util.*, javax.mail.internet.*"%> <% Properties props = new Properties(); props.put("mail.smtp.host", "smtp.polyu.edu.hk"); Session s = Session.getDefaultInstance(props); MimeMessage message = new MimeMessage(s); InternetAddress from = new InternetAddress ("01560455t@polyu.edu.hk"); message.setFrom(from); InternetAddress to = new InternetAddress("monkeynonno@hotma   More>>
Java Mail

hi, I'm new to JavaMail, I have a problem on my 1st JavaMail jsp, anyone can help me pls? below is the jsp:


<%@ page contentType="text/html" import="javax.mail.*, java.util.*, javax.mail.internet.*"%>









<%

Properties props = new Properties();

props.put("mail.smtp.host", "smtp.polyu.edu.hk");

Session s = Session.getDefaultInstance(props);

MimeMessage message = new MimeMessage(s);

InternetAddress from = new InternetAddress
("01560455t@polyu.edu.hk");

message.setFrom(from);

InternetAddress to = new InternetAddress("monkeynonno@hotmail.com");

message.addRecipient(Message.RecipientType.TO, to);

message.setSubject("Test fromJavaMail.");

message.setText("Hello from JavaMail!");

Transport.send(message);

%>



Mail has been sent to monkeynonno@hotmail.com








here's the error:


org.apache.jasper.JasperException: Sending failed;

nested exception is:
class javax.mail.SendFailedException: Invalid Addresses;

nested exception is:
class javax.mail.SendFailedException: 550 ... we do not relay

   <<Less

Re: problem on sending email

Posted By:   Christopher_Koenigsberg  
Posted On:   Monday, December 30, 2002 07:00 AM

The SMTP server you tried, "smtp.polyu.edu.hk", is telling you "we do not relay". You need to talk to the postmaster/sysadmin's there.

Re: problem on sending email

Posted By:   Anvar_Salim  
Posted On:   Sunday, December 29, 2002 01:01 AM

Hi,
It is not important still let me ask, what is 'from' there?
It haven't seen declared!.. Is that is the error.

And another chance is about your smtp host name.
Where the smtp server is located???
And one more thing,
try to create Properties object by using
Properties pro=System.getProperties() method.
ur code is absolutely right.
Any way write in details.
bye ....
About | Sitemap | Contact