Eran's blog

Bulk Email Tips and Tricks

DomainKeys authenticationDomainKeys is designed to verify the Email sender’s domain. Most ISPs out there seem to have moved on to DKIM (Domain Keys Identified Mail) but not Yahoo. To get Yahoo to authenticate your DK signed messages you need to include a DomainKeys signature. You can actually get both DomainKeys and DKIM together with DKIMProxy but the documentation is slightly out of date.

To get DKIMProxy to sign using DomainKeys in addition or instead of DKIM follow the instructions for setting up a DKIMProxy_out.conf file on Brandon Checketts’ web site. You may also find his DKIM Validator to be useful.

Sending Email on Behalf – Sometimes you want the sender to be someone other than yourself. For example when users send invites through your website you may want the From field to show the sender’s Email address and name. This requires understanding some SMTP subtleties (envelope sender vs. sender header vs. from header) but there’s some good examples on how to do this on the openSPF website.

Sending from Non-standard ports using JavaMail – If you’re using DKIMProxy you may end up sending email through port 587 (based on the recommended setup). Java makes it a but more complicated than it should be but I found a good bit of sample code here. This boils down to something like:

Transport tr = new SMTPTransport(session, new URLName(smtpHost));
tr.connect(smtpHost, smtpPort, username, password);
tr.sendMessage(msg, recipients);

Calling the connect method yourself is the important part. It seems that otherwise SMTPTransport will use port 25 even if you specify differently in the session’s properties.

Filed under: Java, The Net, , , , , , , , , ,