Okay, so I have a program that sends an email when it is finished running. I use inline css to format the email. This was working up until yesterday however now I am seeing different formats depending on which email account I view the email in. It coincides with an upgrade from Selenium 2.35.0 to 2.37.0 however I don't think this is my issue since I rolled back to 2.35.0 and it still happens.
package tests;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class TESTTEST {
public static void main(String[] args) throws Exception
{
Properties props = new Properties();
props.put("mail.smtp.host","xxx.xxx.xxx.xxx");
Session session = Session.getInstance(props);
String emailFrom="
[email protected]";
String emailTo1="
[email protected]";
MimeMessage message = new MimeMessage(session);
message.setSubject("Testing HTML Email");
message.setFrom(new InternetAddress(emailFrom));
String htmlBody = "<STYLE>body {font-family:sans-serif,arial,helvetica,sans-serif;font-size:9pt;}"
+"TABLE {border-collapse:collapse;border:1px solid black;}"
+"TH {background-color:grey;color:white;padding:5px;border:1px solid black;font-size:9pt;}"
+"TD {padding:5px;border:1px solid black;font-size:9pt;}"
+"H3 {font-size:12pt;}"
+".PASSED {background-color:#00FF00}"
+".FAILED {background-color:#FF0000}"
+".SKIPPED {background-color:#DEDEDE}"
+".ITALIC {font-style:italic}"
+"</STYLE>"
+ "<TABLE><TR><TD CLASS=PASSED>FAIL</TD><TD STYLE=background-color:#FF0000>FAIL</TD></TR></TABLE>";
message.setContent(htmlBody, "text/html; charset=ISO-8859-1");
message.addRecipient(Message.RecipientType.TO,new InternetAddress(emailTo1));
Transport.send(message,message.getRecipients(Message.RecipientType.TO));
System.out.println(htmlBody);
System.out.println("Email Sent");
}
}
When I view the email in Hotmail/Outlook.com, it looks fine
In Gmail
In Lotus Notes
Anybody able to help?