Hi,
I am using java application to send email.
My Email server is "Godaddy.com".
host is smtpout.secureserver.net
port is : 25
when I use gmail(smtp.gmail.com) it works fine, but using godaddy I can't send mail
this is my code:
MimeMessage message = new MimeMessage(session);
message.setSender(new InternetAddress("vinoth@clss.in"));
message.setSubject("test");
message.setContent("Hi pon", "text/html");
message.setRecipient(Message.RecipientType.TO, new InternetAddress("xxxx@clss.in"));
Transport.send(message);
---------------------------------------------------------------------------------------------------------------------------------------------------------
I get Error message like this:
--------------------------------------
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 553 sorry, relaying denied from your location [115.117.232.45] (#5.7.1)
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1835)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1098)
at javax.mail.Transport.send0(Transport.java:195)
at javax.mail.Transport.send(Transport.java:124)
at Mailing.SendMail.clss_sendMail(SendMail.java:107)
at Mailing.SendMail.main(SendMail.java:31)
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 553 sorry, relaying denied from your location [115.117.232.45] (#5.7.1)
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1686)
... 5 more
Even i have faced this error invalid address error was coming because of from addres
so make sure that from adress field will be same,as what you have authenticated..
and before saying
transport.send(message);
First get the transport protocol using...
Transport transport = session.getTransport("smtp");
See that error message, "553 sorry, relaying denied from your location"? That means that you're connecting perfectly. The problem is after that - you are trying to relay, and that's not allowed with this SMTP server. The problem is not in your code but in the server configuration.
Why not you try using IP Address,Instead of host name.I hope it will work fine.
Why would it? As Rob pointed out, connectivity is not the problem.
Yes you are right..Connectivity is working fine..but here is the solution.
"The email program you already use for sending and receiving messages can easily be used along with the server just by using the IP address "127.0.0.1" instead of your current SMTP host"
just giving a try to solve it..May be it works with a IP.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35238
7
posted
0
You fundamentally misunderstand what the page you linked to is talking about; it's about running a local mail server - that's hardly the sort of solution vinoth Robert is looking for.
Session mailSession = Session.getDefaultInstance(props, null);
mailSession.setDebug(true);
Transport transport = mailSession.getTransport("smtp");
MimeMessage message = new MimeMessage(mailSession);
message.setSentDate(new java.util.Date());
message.setSubject("Hi Test");
message.setFrom(new InternetAddress("xxxxx@xxxx.com"));
message.setRecipient(Message.RecipientType.TO, new InternetAddress("toxxx@xxxx.com"));
MimeMultipart multipart = new MimeMultipart("related");
// first part (the html)
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent("Hi rsgdsdgdfgsdfg", "text/html");
// add it
multipart.addBodyPart(messageBodyPart);
// put everything together
message.setContent(multipart);