• GoDaddy Community
  • VPS & Dedicated Servers
  • VPS & Dedicated Servers

    cancel
    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 
    Go to solution
    New

    Not able to send mail using my goDaddy mail account from my website

    String emailPort = "465";// gmail's smtp port

     

    emailProperties= System.getProperties();

    emailProperties.put("mail.smtp.port", emailPort);

    emailProperties.put("mail.smtp.auth", "true");

    emailProperties.put("mail.smtp.starttls.enable", "true");

     

    String[] toEmails = { "************@gmail.com" };

    String emailSubject = "Any Subject.";

    String emailBody = "Any text";

     

    mailSession= Session.getDefaultInstance(emailProperties, null);

    emailMessage= new MimeMessage(mailSession);

     

    for (int i = 0; i < toEmails.length; i++) {

    emailMessage.addRecipient(Message.RecipientType.TO, new InternetAddress(toEmails[i]));

    }

     

    emailMessage.setSubject(emailSubject);

    emailMessage.setContent(emailBody, "text/html");

     

    String emailHost = "smtpout.secureserver.net";

    String fromUser = "[goDaddyMailAccount]";

    String fromUserEmailPassword = "***********";

     

    Transport transport = mailSession.getTransport("smtp");

     

    transport.connect(emailHost, fromUser, fromUserEmailPassword);

    transport.sendMessage(emailMessage, emailMessage.getAllRecipients());

    transport.close();

    System.out.println("Email sent successfully.");

     

     

     

     

     

     

    Getting error:

    Could not connect to SMTP host: smtpout.secureserver.net, port: 465, response: -1

    3 REPLIES 3
    Super User II
    Super User II

    Re: Not able to send mail using my goDaddy mail account from my website

    Hello 

     

    Zulfiqar Anees | GoDaddy Pro | Founder/CEO at FastTech Media, TechMag, and ZulWeb.
    New

    Re: Not able to send mail using my goDaddy mail account from my website

    I am using a dedicated server, not a shared hosting account.

    Highlighted
    Employee
    Employee
    Solution

    Re: Not able to send mail using my goDaddy mail account from my website

    Hi @laksh 

     

    The standard SMTP port is 25.  Try using that port number.  I also don't recognize "smtpout.secureserver.net", but it might be an older relay server.  Take a look at this help article for an up-to-date list of smtp relay servers: https://ie.godaddy.com/help/find-my-generation-4-smtp-relay-server-24736