AdobeBridgeCS5SDK

Class BasicEmailer

Object
   |
   +--BasicEmailer

class BasicEmailer


Shows how to use the Socket object to send emails with attachments from Bridge.

Usage

You must edit the mailserver settings within this code; the code as shipped does not provide any default values for these settings and if you do not edit these settings in the code (see "NOTE" below), then the code will not run correctly.
  1. Customize the email settings in the code to match your mail system and user accounts; look for NOTE below.
  2. Run the snippet in the ExtendScript Toolkit, with Adobe Bridge CS5 as the target (see Readme.txt).
  3. You should find this creates a context-sensitive menu item on file thumbnails.
  4. In Bridge, select one or more thumbnails for the files to send. Ideally, choose small files.
  5. Right click in Windows or Ctrl-click in Mac OS to invoke the context menu.
  6. Select the menu item "SDK BasicEmailer: Send by Email"
  7. Inspect the JavaScript console for confirmation of the email being sent.
  8. Check your email client for the arrival of an email with attached files.

Description

This example uses the Socket object to send an email with multiple attachments, by writing to an SMTP server. Attachments are sent as binary data, encoded into Base64 encoding.

This sample sends a single email message at a time, and blocks the main thread in Bridge until the message has been sent. You should select small files (under 100Kb) to send. For a non-blocking example, suitable for sending larger files, see BackgroundEmailer.jsx

Note that this sample is a demonstration of a technique; it may not run as expected with all mail servers, and is not intended to be a robust mail client.

See:

Defined in BasicEmailer.jsx


Field Summary
 String boundary
          The boundary for attachments
 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 message
          The body text of the message
 Socket password
          The password for the username - NOTE: You must customize this with your own password value.
 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 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 requiredContext
          The context in which this sample can run.
 String sender
          The senders email address, for example testemail
 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.
 Socket socket
          The socket object which this object uses to write to the wire
 String subject
          The subject of the email
 String username
          The username, not necessarily the email address, to authorize with, for example testemail
 
Constructor Summary
BasicEmailer()
           
 
Method Summary
 void addAttachment()
           Adds attachments to the email being sent
 void authorise()
           Authorizes a username against POP3
 void buildMessage()
           Constructs a simple message for the body of the email showing which files are attached.
 Boolean canRun()
           Determines whether snippet can be run in the current context.
 Object close()
           Closes the socket that was used to transmit data
 Boolean connect(host, port)
           Attempts to open a socket and connect to a host and port.
 Boolean doCommand(cmd, type)
           Carries out either an SMTP or a POP command.
 String encodeAttachment(binaryString)
           Accepts a string representing a binary file and encodes it as base64, to allow attachments to be sent via email
 Boolean run()
           Functional part of this snippet.
 Boolean send()
           Sends the email and attachments by connecting to the server and authorizing via POP.

Field Detail

boundary

String boundary

mailServerName

String mailServerName

message

String message

password

Socket password

POP

int POP

recipient

String recipient

requiredContext

String requiredContext

sender

String sender

SMTP

int SMTP

socket

Socket socket

subject

String subject

username

String username

Constructor Detail

BasicEmailer

BasicEmailer()

Method Detail

addAttachment

void addAttachment()

authorise

void authorise()

buildMessage

void buildMessage()

canRun

Boolean canRun()

close

Object close()

connect

Boolean connect(host, port)

doCommand

Boolean doCommand(cmd, type)

encodeAttachment

String encodeAttachment(binaryString)

run

Boolean run()

send

Boolean send()

AdobeBridgeCS5SDK

http://www.adobe.com/devnet/bridge
Documentation generated by JSDoc on Tue Apr 27 10:21:34 2010