Hi all,
I was jus working around with the JavaMail API and was stuck at the end with an error from the smtp server saying that
Your email message was unable to be sent because your mail server rejected the message:
550 Invalid recipient : b@b.com
Googled for almost the entire day for a solution but in no avail.
The code i use is in a jsp page and is as follows:
<%@page import="java.ut il.Properties"% >
<%@page import="javax.m ail.*"%>
<%@page import="javax.m ail.internet.*" %>
<%
String smtpHost ="localhost" ;
String from ="a@a.com";
String to ="b@b.com"; // ---- These "from" and "to" are absolutely valid email ids i used !!
Properties props = new Properties();
props.put("mail .smtp.host", smtpHost);
MimeMessage message = new MimeMessage(Ses sion.getDefault Instance(props, null));
message.setFrom (new InternetAddress (from));
message.addReci pient(Message.R ecipientType.TO ,new InternetAddress (to));
message.setSubj ect("Test Mail");
message.setText ("Welcome to the JDC");
Transport.send( message);
%>
The reason i used "localhost" for smtp host is that i am running a free smtp server i downloaded and i ve checked with the smtp conversations with the application and it works fine.
Any Help ??
Many Thanks in advance..
I was jus working around with the JavaMail API and was stuck at the end with an error from the smtp server saying that
Your email message was unable to be sent because your mail server rejected the message:
550 Invalid recipient : b@b.com
Googled for almost the entire day for a solution but in no avail.
The code i use is in a jsp page and is as follows:
<%@page import="java.ut il.Properties"% >
<%@page import="javax.m ail.*"%>
<%@page import="javax.m ail.internet.*" %>
<%
String smtpHost ="localhost" ;
String from ="a@a.com";
String to ="b@b.com"; // ---- These "from" and "to" are absolutely valid email ids i used !!
Properties props = new Properties();
props.put("mail .smtp.host", smtpHost);
MimeMessage message = new MimeMessage(Ses sion.getDefault Instance(props, null));
message.setFrom (new InternetAddress (from));
message.addReci pient(Message.R ecipientType.TO ,new InternetAddress (to));
message.setSubj ect("Test Mail");
message.setText ("Welcome to the JDC");
Transport.send( message);
%>
The reason i used "localhost" for smtp host is that i am running a free smtp server i downloaded and i ve checked with the smtp conversations with the application and it works fine.
Any Help ??
Many Thanks in advance..