R
ruds
I'm trying to send email through JSP, here is my code:
<%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*,
javax.activation.*, javax.mail.util.*, java.util.Properties" %>
<%
String from_user="(e-mail address removed)"; // for e.g.
String toAddress = "(e-mail address removed)";
// out.println(from_user);
// out.println(toAddress);
Properties props = new Properties();
props.put("mail.smtp.host", "128.9.100.20");
Session ses = Session.getDefaultInstance(props, null);
/*if (debug)
ses.setDebug(true);*/
MimeMessage message = new MimeMessage(ses);
InternetAddress from = new InternetAddress(from_user);
message.setFrom(from);
InternetAddress to = new InternetAddress(toAddress);
message.addRecipient(Message.RecipientType.TO, to);
String subject = "FIR Query";
message.setSubject(subject);
String text = request.getParameter("msg");
message.setText(text);
message.setContent(text, "text/html");
Transport.send(message);
%>
<html>
<p align="center">The Message has been sent.</p>
<p align="center"><a href="./login.jsp">Click here to send another!</
a></p>
</html>
I'm getting error as;
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to
relay for (e-mail address removed)
What could be the problem?
<%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*,
javax.activation.*, javax.mail.util.*, java.util.Properties" %>
<%
String from_user="(e-mail address removed)"; // for e.g.
String toAddress = "(e-mail address removed)";
// out.println(from_user);
// out.println(toAddress);
Properties props = new Properties();
props.put("mail.smtp.host", "128.9.100.20");
Session ses = Session.getDefaultInstance(props, null);
/*if (debug)
ses.setDebug(true);*/
MimeMessage message = new MimeMessage(ses);
InternetAddress from = new InternetAddress(from_user);
message.setFrom(from);
InternetAddress to = new InternetAddress(toAddress);
message.addRecipient(Message.RecipientType.TO, to);
String subject = "FIR Query";
message.setSubject(subject);
String text = request.getParameter("msg");
message.setText(text);
message.setContent(text, "text/html");
Transport.send(message);
%>
<html>
<p align="center">The Message has been sent.</p>
<p align="center"><a href="./login.jsp">Click here to send another!</
a></p>
</html>
I'm getting error as;
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to
relay for (e-mail address removed)
What could be the problem?