How do you send email from a java application while using an obscure domain? -


i trying send email email account uses hostmonster domain. have been using code found in post works great gmail having trouble adapting suit domain. original code is:

properties props = system.getproperties();     string host = "smpt.gmail.com";     props.put("mail.smtp.starttls.enable", "true");     props.put("mail.smtp.host", host);     props.put("mail.smtp.user", from);     props.put("mail.smtp.password", pass);     props.put("mail.smtp.port", "587");     props.put("mail.smtp.auth", "true"); 

from have changed host , port fit domain. host being "host407.hostmonster.com" , outgoing smtp port being 465. when run application these changes nothing happens. don't error code couldn't connect server, password wrong, or other feedback, keeps running while when used gmail took between 2 , 3 seconds run application , send several emails. @ loss try , haven't been able find posts here using email other big name domains, appreciated!

edit: should have included of own code sorry, here is:

   import java.io.file;    import java.io.filenotfoundexception;    import java.util.*;    import javax.mail.*;    import javax.mail.internet.*;    public class formater {  private static string user_name = "***********";  // gmail user name (just part before "@gmail.com") private static string password = "********"; // gmail password private static string[] recipients = { "***************", "*************"}; //"******************", private static string weathertext = "this weather text , how look."; private static file outputfolder = new file("c:/users/***** *******/documents/**********/output/test.txt"); private static arraylist<string> text = new arraylist<>();   public static void main(string[] args) throws filenotfoundexception {     string = user_name;     string pass = password;     string[] = { "**************"}; // list of recipient email addresses     string[] bcc =  recipients;     string subject = "java send mail example";     string body = "welcome javamail!";     sendfrommail(from, pass, to, bcc, subject, body);  }  private static void sendfrommail(string from, string pass, string[] to, string[] bcc, string subject, string body) throws filenotfoundexception {     properties props = system.getproperties();     string host = "host407.hostmonster.com";     props.put("mail.smtp.starttls.enable", "true");     props.put("mail.smtp.host", host);     props.put("mail.smtp.user", from);     props.put("mail.smtp.password", pass);     props.put("mail.smtp.port", "465");     props.put("mail.smtp.auth", "true");       session session = session.getdefaultinstance(props);     mimemessage message = new mimemessage(session);      try {         message.setfrom(new internetaddress(from));         internetaddress[] toaddress = new internetaddress[to.length];         internetaddress[] bccaddress = new internetaddress[bcc.length];          // array of addresses         for( int = 0; < to.length; i++ ) {             toaddress[i] = new internetaddress(to[i]);         }          for( int = 0; < toaddress.length; i++) {             message.addrecipient(message.recipienttype.to, toaddress[i]);         }          for( int = 0; <bcc.length;i++){             bccaddress[i] = new internetaddress(bcc[i]);         }          for( int = 0; i<bccaddress.length; i++){             message.addrecipient(message.recipienttype.bcc, bccaddress[i]);         }         message.setsubject(subject);         //message.settext(body);          message.setcontent("<!doctype html>\n" + 

well got bored , started trying random ports see if maybe 1 work, , third port (587) tried worked.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -