java - Unable to email in HTML format. -


i trying send email in html format. working text/plain. when set content type text/html mail not being transported(no exception being thrown don't email well). following code.

public void postmail() throws exception {             boolean debug = false;              properties props = new properties();             props.put("mail.smtp.host", smtpserver);             props.put("mail.smtp.port", smtpserverport);             props.put("mail.smtp.auth", "false");             props.put("mail.smtp.socketfactory.class","javax.net.ssl.sslsocketfactory");             props.put("mail.smtp.socketfactory.fallback","false");             lgr.debug(lgr.isdebugenabled()?"smtp server --->" + smtpserver : null);             session session = session.getinstance(props, null);             session.setdebug(debug);              message msg = new mimemessage(session);              internetaddress addressfrom = new internetaddress(from);             msg.setfrom(addressfrom);             // here logic add , cc , bcc             msg.setsubject(subject);             //    writer.println("subject : " + subject);             lgr.debug(lgr.isdebugenabled()?"subject : " + subject : null);             msg.setcontent(message, "text/html");             transport.send(msg);             lgr.info(lgr.isinfoenabled() ?"mail sent": null); } 

any in regard highly appreciated.

get rid of socket factory stuff, don't need it.

when set debug true, see errors in debug output? or mail server accepting message without complaint? if no errors, problem recipient's mail server thinks message spam, although seems unlikely simple test message.

have tried sending different recipients, different recipients using different mail servers? useful figure out if problem recipient's mail server or mail server you're using sending.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -