Helma logo
helma.org » Home > Stories > Mail.addPart()

Mail.addPart()

Adds an attachment to an e-mail message.

Syntax
mailObject.addPart(fileOrMimeObject, nameString)

The attachment needs to be either a MIME Object or a java.io.file object.

Use the getURL() function to retrieve a MIME object or wrap a java.io.File object around a file of the local file system.

Example
var file1 = getURL("http://localhost:8080/static/image.gif");
var file2 = getURL("file:////home/snoopy/woodstock.jpg");
var file3 = new java.io.File("/home/snoopy/woodstock.jpg");
var mail = new Mail();
mail.addPart(file1);
mail.addPart(file2);
mail.addPart(file3);

mail.setFrom("snoopy@doghouse.com");
mail.setTo("woodstock@birdcage.com");
mail.setSubject("Look at this!");
mail.addText("I took a photograph from you. Neat, isn't it? -Snoop");
mail.send();


... comment


Page last modified on 2002-07-17 12:42 by tobi