http://www.adobe.com ExtendScript ToolKit

EmailWithAttachment Class Reference

List of all members.

Public Member Functions

void EmailWithAttachment ()
Boolean send ()
 Sends the email and attachments by connecting to the server and authorizing via POP.
Boolean canRun ()
 Determines whether snippet can be run in the current context.
Boolean run ()
 Functional part of this snippet.
void close ()
 Closes the socket that was used to transmit data.
Boolean connect (void host, void port)
 Attempts to open a socket and connect to a host and port.
void authorise ()
 Authorizes a username against POP3.
String encodeAttachment (void binaryString)
 Accepts a string representing a binary file and encodes it as base64, to allow attachments to be sent via email.
Boolean doCommand (void cmd, void type)
 Carries out either an SMTP or a POP command.
void addAttachment ()
 Adds attachments to the email being sent.
void buildMessage ()
 Constructs a simple message for the body of the email showing which files are attached.

Public Attributes

String requiredContext
 The context in which this sample can run.
Socket password
 The password for the username - NOTE: You must customize this with your own password value.
String boundary
 The boundary for attachments.
String recipient
 The address the email will be sent to, the receiver of the email - NOTE: You must customize this with your own recipient address.
String subject
 The subject of the email.
int POP
 The port number for the POP server, for example port 110 - NOTE: You may need to customize this with your own port number.
String username
 The username, not necessarily the email address, to authorize with, for example [email protected] - NOTE: You must customize this with your own username value.
Socket socket
 The socket object which this object uses to write to the wire.
String message
 The body text of the message.
String mailServerName
 The host address for the mail server, for example mail.adomainname.com - NOTE: You must customize this with your own host address value.
String sender
 The senders email address, for example [email protected]
  • NOTE: You must customize this with your own email address.

int SMTP
 The port number for the SMTP server, for example port 25 - NOTE: You may need to customize this with your own port number.


Constructor & Destructor Documentation

void EmailWithAttachment::EmailWithAttachment (  ) 


Member Function Documentation

Boolean EmailWithAttachment::send (  ) 

Sends the email and attachments by connecting to the server and authorizing via POP.

Reestablishes the connection and sends the necessary commands to the SMTP server. If there are attachments to be sent, encodes them into Base64 and writes them to the socket.

Returns:
True if the mail was sent succesfully.

Boolean EmailWithAttachment::canRun (  ) 

Determines whether snippet can be run in the current context.

The snippet fails if these preconditions are not met:

  • The mail configuration settings must been modified
  • The image file 'EmailWithAttachment.jpg' must exist the resources folder of the SDK samples
Returns:
True if this snippet can run, false otherwise

Boolean EmailWithAttachment::run (  ) 

Functional part of this snippet.

Runs this sample, calling the helper functions defined below. Creates the Socket object and applies mail settings, such as hostname, password, and so on. You must customize the code so that the mail settings correspond to your mail system and user accounts; otherwise, the sample fails and no emails are sent.

Returns:
True if the sample ran as expected, false otherwise

void EmailWithAttachment::close (  ) 

Closes the socket that was used to transmit data.

Boolean EmailWithAttachment::connect ( void  host,
void  port 
)

Attempts to open a socket and connect to a host and port.

Parameters:
host The host name string of the server to connect to
port The port number to connect on, an integer
Returns:
True if the socket opened successfully, false otherwise

void EmailWithAttachment::authorise (  ) 

Authorizes a username against POP3.

String EmailWithAttachment::encodeAttachment ( void  binaryString  ) 

Accepts a string representing a binary file and encodes it as base64, to allow attachments to be sent via email.

Parameters:
binaryString The string to encode
Returns:
The base64-encoded string

Boolean EmailWithAttachment::doCommand ( void  cmd,
void  type 
)

Carries out either an SMTP or a POP command.

Separates writing data to the socket and sending commands.

Parameters:
cmd The command to be written to the socket
type One of 'pop' or 'smtp'
Returns:
True if the command was executed correctly

void EmailWithAttachment::addAttachment (  ) 

Adds attachments to the email being sent.

void EmailWithAttachment::buildMessage (  ) 

Constructs a simple message for the body of the email showing which files are attached.


Member Data Documentation

The context in which this sample can run.

The password for the username - NOTE: You must customize this with your own password value.

The boundary for attachments.

The address the email will be sent to, the receiver of the email - NOTE: You must customize this with your own recipient address.

The subject of the email.

The port number for the POP server, for example port 110 - NOTE: You may need to customize this with your own port number.

The username, not necessarily the email address, to authorize with, for example [email protected] - NOTE: You must customize this with your own username value.

The socket object which this object uses to write to the wire.

The body text of the message.

The host address for the mail server, for example mail.adomainname.com - NOTE: You must customize this with your own host address value.

The senders email address, for example [email protected]

  • NOTE: You must customize this with your own email address.

The port number for the SMTP server, for example port 25 - NOTE: You may need to customize this with your own port number.


The documentation for this class was generated from the following file:

Adobe Solutions NetworkCopyright© 2008 Adobe Systems Incorporated. All rights reserved.

Terms of Use  Online Privacy Policy  Adobe and accessibility  Avoid software piracy  Permissions and Trademarks