org.apache.tools.ant.taskdefs.email

Class Message

public class Message extends ProjectComponent

Class representing an email message.

Since: Ant 1.5

Constructor Summary
Message()
Creates a new empty message
Message(String text)
Creates a new message based on the given string
Message(File file)
Creates a new message using the contents of the given file.
Method Summary
voidaddText(String text)
Adds a textual part of the message
StringgetCharset()
Returns the charset of mail message.
StringgetMimeType()
Returns the content type
booleanisMimeTypeSpecified()
Returns true if the mimeType has been set.
voidprint(PrintStream ps)
Prints the message onto an output stream
voidsetCharset(String charset)
Sets the character set of mail message.
voidsetMimeType(String mimeType)
Sets the content type for the message
voidsetSrc(File src)
Sets the source file of the message

Constructor Detail

Message

public Message()
Creates a new empty message

Message

public Message(String text)
Creates a new message based on the given string

Parameters: text the message

Message

public Message(File file)
Creates a new message using the contents of the given file.

Parameters: file the source of the message

Method Detail

addText

public void addText(String text)
Adds a textual part of the message

Parameters: text some text to add

getCharset

public String getCharset()
Returns the charset of mail message.

Returns: Charset of mail message.

Since: Ant 1.6

getMimeType

public String getMimeType()
Returns the content type

Returns: the mime type

isMimeTypeSpecified

public boolean isMimeTypeSpecified()
Returns true if the mimeType has been set.

Returns: false if the default value is in use

print

public void print(PrintStream ps)
Prints the message onto an output stream

Parameters: ps The print stream to write to

Throws: IOException if an error occurs

setCharset

public void setCharset(String charset)
Sets the character set of mail message. Will be ignored if mimeType contains ....; Charset=... substring.

Parameters: charset the character set name.

Since: Ant 1.6

setMimeType

public void setMimeType(String mimeType)
Sets the content type for the message

Parameters: mimeType a mime type e.g. "text/plain"

setSrc

public void setSrc(File src)
Sets the source file of the message

Parameters: src the source of the message