« Posts tagged email

Sending Attachments with the Javamail 1.4.x API

Make your emails interesting with attachments!

Not that your emails aren’t already interesting – if you have some kind of regular job running and you want to produce a results bound file sent to your recipients as an attachment, this code example can illustrate one way it can be done. It’s pretty much the same thing as sending a regular email except that it uses multipart attachments as the body content of the message:

package com.faceroller.mail;

public class Mailer {

	private static final Log log = LogFactory.getLog(Mailer.class);

	public static void send(Email email)
			throws MessagingException, NamingException, IOException {



[Read the rest]

Configre Sendmail

If you need a simple MTA that will send mail across the internet, sendmail is a commonly used provider. It ships with most linux distributions and can be configured with relative ease. The other competing out of the box solution is postifix. Which on to pick? Probably postfix, but I was in a hurry and dived in to how to configure sendmail first. I guess eventually I’ll get around to setting up postfix.

Open up the sendmail configuration file:

[root@bedrock ~]# vi /etc/mail/sendmail.mc

Uncomment the flag that bars accepting unresolvable domains:

dnl # We strongly recommend not accepting unresolvable

[Read the rest]