javamail - Java Mail won't work remotely -


I have clearly created a Java Mail Surlet to send emails, it works perfectly well on the production server, But when I try and run it on my home server, I get this error message

javax.mail.SendFailedException: Invalid address;

javax .servlet.ServletException: javax.mail.SendFailedException: Invalid addresses; The nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 554 5.7.1 & LT; * @ googlemail.com>: Refused to relay access

  evo.net.Mail.service (Mail.java: 60) javax.servlet.http.HttpServlet.service (HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter (WsFilter Java: 52   

In the servlet The host name variable changed from the local host to the server's IP and it was not a difference

my code:.

  package evo.net; import java.util . * Import javax.mail * import javax.mail.Session; import javax.mail.internet. * Import javax.activation. *; Import Java io.IOException; import java.io.printWriter; import javax.servlet.ServletException; Import javax.servlet.annotation.WebServl Et; import javax.servlet.http.httpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet Http.HttpServletResponse; @WebServlet ("/ mail") public class mail HttpServlet detailed {personal fixed last long serialVer sionUID = 1 L; Public Mail () {Super ();} Protected Zero Service (HttpServletRequest Request, HttpServletResponse Response) throws ServletException, IOException {PrintWriter = Out Response.getWriter (); String to = "********"; String = "*******@codeprojects.co.uk"; String host = "codeprojects.co.uk"; Properties Props = System.getProperties (); props.put ("mail.smtp.host", host); Props.put ("mail.smtp.auth", "true"); Session session = Session.getDefaultInstance (support, new authenticator) {Protected PasswordAuthentication getPasswordAuthentication () {New PasswordAuthentication ("Root" to return, "*****");}}); {Try transport trance = session.getTransport ("smtp"); trans.connect ("root", "******"); MimeMessage Message = New MimeMessage (Session); Message.setFrom (new Internet address (from)); Message.addRecipient (Message.RecipientType.TO, new Internet address); message.setSubject ("subject"); message.setText ("Hello World"); trans.sendMessage (message, message.getAllRecipients ()) ;; out.println ("test"); } Catching (Messaging Execsist Max) {New Service Extension (Mexico); }}}    

"postproperty" itemprop = "text">

Google Verify domain is sending from you (or saying) By sending you)

If you are using a development account, you will get different behaviors from production accounts.



Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -