jasp.smtp
Class Mailer

java.lang.Object
  extended byjasp.smtp.Mailer

public class Mailer
extends java.lang.Object

J-ASP Mail allows you to send mail using the standard SMTP protocol from any java program
Features include:


Constructor Summary
Mailer()
           
 
Method Summary
 void AddAttachment(java.lang.String file)
          Adds attachments to current mailing.
 boolean AddBCC(java.lang.String mail)
          Adds a new Blind Carbon Copy recipient.
 boolean AddBCC(java.lang.String name, java.lang.String mail)
          Adds a new Blind Carbon Copy recipient.
 boolean AddCC(java.lang.String mail)
          Adds a new recipient, as shown in the message's CC list.
 boolean AddCC(java.lang.String name, java.lang.String mail)
          Adds a new recipient, as shown in the message's CC list.
 void AddExtraHeader(java.lang.String h)
          Adds extra X-Headers to the mail envelope.
 boolean AddRecipient(java.lang.String mail)
          Adds a new recipient, as shown in the message's To: list.
 boolean AddRecipient(java.lang.String name, java.lang.String mail)
          Adds a new recipient, as shown in the message's To: list.
 void ClearAllRecipients()
          Clears all recipients assigned to the To, CC and BCC lists.
 void ClearAttachments()
          Clears any attachments that were previously set.
 void ClearBCCs()
          Clears any recipients assigned to the BCC list.
 void ClearBodyText()
          Clears any text assigned to the message’s body which may have been set previously by using the BodyText property
 void ClearCCs()
          Clears any recipients assigned to the CC list.
 void ClearExtraHeaders()
          Clears any X-Headers that were set by use of AddExtraHeader.
 void ClearRecipients()
          Clears any recipients assigned to the To list.
 void EncodeHeader()
          Encodes a string in RFC1522 format to provide support for 8bit mail headers such as 8bit subject headers.
 java.lang.String getBodyText()
          Gets the message body text.
 void GetBodyTextFromFile(java.lang.String file)
          Loads message's body text from a file.
 int getCharset()
          Gets the character set.
 boolean getConfirmread()
          Gets the ConfirmReading flag.
 java.lang.String getContenttype()
          Gets the ContentType header of the message's BodyText.
 java.lang.String getCustomcharset()
          Gets the custom charactor set
 java.lang.String getDatetime()
          Gets the data-time header.
 int getEncoding()
          Gets the encoding type for attachments.
 java.util.Date getExpires()
           
 java.lang.String getFromAddress()
          Returns the message originator’s email address.
 java.lang.String getFromName()
          Returns the message originator’s name.
 boolean getIgnoreMalFormedAddress()
           
 boolean getIgnoreRecipientErrors()
           
 boolean getLive()
           
 java.lang.String getOrganization()
          Returns the Organization header in the message.
 java.lang.String getPGPParams()
           
 java.lang.String getPGPPath()
           
 int getPriority()
           
 java.lang.String getRemoteHost()
          Gets the remote SMTP host.
 java.lang.String getReplyTo()
          Returns the email address that replies should be sent to.
 java.lang.String getResponse()
          Returns any error messages that may occur
 boolean getReturnReceipt()
          Gets the ReturnReceipt flag
 java.lang.String getSmtpLog()
           
 java.lang.String getSubject()
          Returns the message subject.
 boolean getSuppressMsgBody()
           
 java.lang.String GetTempPath()
          Returns <J-ASP-installed dir>\logs\ .
 int getTimeout()
           
 boolean getUrgent()
           
 boolean getUseMSMailHeaders()
           
 java.lang.String getVersion()
           
 boolean getWordWrap()
           
 int getWordWrapLen()
           
 boolean SendMail()
          Attempts to send the email.
 void setBodyText(java.lang.String b)
          Sets The message body text.
 void setCharset(int chr)
          Sets the character set.
 void setConfirmread(boolean confirm)
          Sets the ConfirmReading flag, If this is set to true AND the recipients email program supports.
 void setContenttype(java.lang.String content)
          Sets the ContentType header of the message's BodyText
 void setCustomcharset(java.lang.String custom)
          Sets the custom charactor set
 void setDatetime(java.lang.String dt)
          Sets the datatime header.
 void setEncoding(int encode)
          Sets the encoding type for attachments.
 void setFromAddress(java.lang.String address)
          Sets the message originator’s email address.
 void setFromName(java.lang.String name)
          Sets the message originator’s name.
 void setIgnoreMalFormedAddress(boolean address)
           
 void setIgnoreRecipientErrors(boolean b)
           
 void setLive(boolean b)
          Allows you to test the component without an SMTP server.
 void setOrganization(java.lang.String org)
          Sets the Organization header in the message.
 void setPassword(java.lang.String pwd)
           
 void setPGPParams(java.lang.String st)
           
 void setPGPPath(java.lang.String path)
           
 void setPriority(int p)
          Sets the message priority
 void setRemoteHost(java.lang.String h)
          Sets the remote SMTP host that the message will be sent through
 void setReplyTo(java.lang.String r)
          Allows you to specify a different email address that replies should be sent to.
 void setResponse(java.lang.String r)
           
 void setReturnReceipt(boolean r)
          Sets the ReturnReceipt flag
 void setSmtpLog(java.lang.String sm)
          Sets the smtplog .
 void setSubject(java.lang.String s)
          Sets the message subject.
 void setSuppressMsgBody(boolean s)
          Sets the SuppressMsgBody property.
 void setTimeout(int t)
          Sets the maximum time that J-ASP Mail should wait for a response from the remote server.
 void setUrgent(boolean r)
          Sets the X-Urgent header in the outgoing message.
 void setUseMSMailHeaders(boolean b)
          Sets MS-Mail priority headers
 void setUserName(java.lang.String name)
           
 void setWordWrap(boolean b)
          Sets WordWrap to true causes the message body to wordwrap at the position specified by the WordWrapLen property.
 void setWordWrapLen(int w)
          Sets WordWrapLen. 70 is default.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mailer

public Mailer()
Method Detail

setBodyText

public void setBodyText(java.lang.String b)
Sets The message body text.


getBodyText

public java.lang.String getBodyText()
Gets the message body text.


getCharset

public int getCharset()
Gets the character set.


setCharset

public void setCharset(int chr)
Sets the character set.


getConfirmread

public boolean getConfirmread()
Gets the ConfirmReading flag.


setConfirmread

public void setConfirmread(boolean confirm)
Sets the ConfirmReading flag, If this is set to true AND the recipients email program supports.


getContenttype

public java.lang.String getContenttype()
Gets the ContentType header of the message's BodyText.


setContenttype

public void setContenttype(java.lang.String content)
Sets the ContentType header of the message's BodyText


getCustomcharset

public java.lang.String getCustomcharset()
Gets the custom charactor set


setCustomcharset

public void setCustomcharset(java.lang.String custom)
Sets the custom charactor set


getDatetime

public java.lang.String getDatetime()
Gets the data-time header.


setDatetime

public void setDatetime(java.lang.String dt)
Sets the datatime header.


getEncoding

public int getEncoding()
Gets the encoding type for attachments.


setEncoding

public void setEncoding(int encode)
Sets the encoding type for attachments.


getExpires

public java.util.Date getExpires()

getFromName

public java.lang.String getFromName()
Returns the message originator’s name.


setFromName

public void setFromName(java.lang.String name)
Sets the message originator’s name.


getFromAddress

public java.lang.String getFromAddress()
Returns the message originator’s email address.


setFromAddress

public void setFromAddress(java.lang.String address)
Sets the message originator’s email address.


getIgnoreMalFormedAddress

public boolean getIgnoreMalFormedAddress()

setIgnoreMalFormedAddress

public void setIgnoreMalFormedAddress(boolean address)

setIgnoreRecipientErrors

public void setIgnoreRecipientErrors(boolean b)

getIgnoreRecipientErrors

public boolean getIgnoreRecipientErrors()

setLive

public void setLive(boolean b)
Allows you to test the component without an SMTP server.


getLive

public boolean getLive()

setOrganization

public void setOrganization(java.lang.String org)
Sets the Organization header in the message.


getOrganization

public java.lang.String getOrganization()
Returns the Organization header in the message.


getPGPPath

public java.lang.String getPGPPath()

setPGPPath

public void setPGPPath(java.lang.String path)

setPGPParams

public void setPGPParams(java.lang.String st)

getPGPParams

public java.lang.String getPGPParams()

setPriority

public void setPriority(int p)
Sets the message priority


getPriority

public int getPriority()

setRemoteHost

public void setRemoteHost(java.lang.String h)
Sets the remote SMTP host that the message will be sent through


getRemoteHost

public java.lang.String getRemoteHost()
Gets the remote SMTP host.


setReplyTo

public void setReplyTo(java.lang.String r)
Allows you to specify a different email address that replies should be sent to.


getReplyTo

public java.lang.String getReplyTo()
Returns the email address that replies should be sent to.


getResponse

public java.lang.String getResponse()
Returns any error messages that may occur


setResponse

public void setResponse(java.lang.String r)

setReturnReceipt

public void setReturnReceipt(boolean r)
Sets the ReturnReceipt flag


getReturnReceipt

public boolean getReturnReceipt()
Gets the ReturnReceipt flag


setSmtpLog

public void setSmtpLog(java.lang.String sm)
Sets the smtplog . if you need to debug the session give a log file name.


getSmtpLog

public java.lang.String getSmtpLog()

setSubject

public void setSubject(java.lang.String s)
Sets the message subject.


getSubject

public java.lang.String getSubject()
Returns the message subject.


setSuppressMsgBody

public void setSuppressMsgBody(boolean s)
Sets the SuppressMsgBody property.


getSuppressMsgBody

public boolean getSuppressMsgBody()

setTimeout

public void setTimeout(int t)
Sets the maximum time that J-ASP Mail should wait for a response from the remote server.


getTimeout

public int getTimeout()

getUrgent

public boolean getUrgent()

setUrgent

public void setUrgent(boolean r)
Sets the X-Urgent header in the outgoing message.


setUseMSMailHeaders

public void setUseMSMailHeaders(boolean b)
Sets MS-Mail priority headers


getUseMSMailHeaders

public boolean getUseMSMailHeaders()

getVersion

public java.lang.String getVersion()

setWordWrap

public void setWordWrap(boolean b)
Sets WordWrap to true causes the message body to wordwrap at the position specified by the WordWrapLen property.


getWordWrap

public boolean getWordWrap()

setWordWrapLen

public void setWordWrapLen(int w)
Sets WordWrapLen. 70 is default. You can modify the position that wordwrap occurs by changing this value.


getWordWrapLen

public int getWordWrapLen()

SendMail

public boolean SendMail()
                 throws java.lang.Exception
Attempts to send the email.

Throws:
java.lang.Exception

AddRecipient

public boolean AddRecipient(java.lang.String name,
                            java.lang.String mail)
Adds a new recipient, as shown in the message's To: list.


AddRecipient

public boolean AddRecipient(java.lang.String mail)
Adds a new recipient, as shown in the message's To: list.


ClearRecipients

public void ClearRecipients()
Clears any recipients assigned to the To list.


AddCC

public boolean AddCC(java.lang.String name,
                     java.lang.String mail)
Adds a new recipient, as shown in the message's CC list.


AddCC

public boolean AddCC(java.lang.String mail)
Adds a new recipient, as shown in the message's CC list.


ClearCCs

public void ClearCCs()
Clears any recipients assigned to the CC list.


AddBCC

public boolean AddBCC(java.lang.String name,
                      java.lang.String mail)
Adds a new Blind Carbon Copy recipient. BCC recipients are not shown in any message recipient list.


AddBCC

public boolean AddBCC(java.lang.String mail)
Adds a new Blind Carbon Copy recipient. BCC recipients are not shown in any message recipient list.


ClearBCCs

public void ClearBCCs()
Clears any recipients assigned to the BCC list.


ClearAllRecipients

public void ClearAllRecipients()
Clears all recipients assigned to the To, CC and BCC lists.


AddAttachment

public void AddAttachment(java.lang.String file)
Adds attachments to current mailing.


ClearAttachments

public void ClearAttachments()
Clears any attachments that were previously set.


ClearBodyText

public void ClearBodyText()
Clears any text assigned to the message’s body which may have been set previously by using the BodyText property


ClearExtraHeaders

public void ClearExtraHeaders()
Clears any X-Headers that were set by use of AddExtraHeader.


AddExtraHeader

public void AddExtraHeader(java.lang.String h)
Adds extra X-Headers to the mail envelope.


GetBodyTextFromFile

public void GetBodyTextFromFile(java.lang.String file)
Loads message's body text from a file. Optionally runs PGP on the message text.


EncodeHeader

public void EncodeHeader()
Encodes a string in RFC1522 format to provide support for 8bit mail headers such as 8bit subject headers.


GetTempPath

public java.lang.String GetTempPath()
Returns <J-ASP-installed dir>\logs\ .


setUserName

public void setUserName(java.lang.String name)

setPassword

public void setPassword(java.lang.String pwd)