tcpcmd.sendMail
Sending a Simple Email MessageThe simplest way to send an email message is with the most powerful smtp client verb, tcpcmd.sendMail.
Each time you run tcpcmd.sendMail, one email message is sent to one or more recipients.
Here is what a very simple example of sendMail looks like:
tcpcmd.sendMail ("smtp.erols.com", "asg@erols.com", "dwiner@well.com", "Love Note", "We love Frontier, Dave!\rThanks!")This sends the message that will appear as this:
Note that the second parameter shown above is "asg@erols.com". This is my email address (I'm the sender in this example), but I could use user.mailaddress, which is a Frontier database object containing the email name of the current Frontier user. In fact, that's the default parameter if you don't provide it.
New in Version 1.0b7.3 - The second parameter has become much more powerful by letting you specify "To:", "Cc:", and "Bcc:" addresses.The syntax of tcpcmd.sendMail is:
tcpcmd.sendMail (emailHost, fromAddress, toAddress, emailSubject, emailData [,mimetype] [,timeout])where:
emailHostis astringcontaining the name of your smtp server (or whichever smtp server you want to use).
"smtp.erols.com"
fromAddressastringcontaining the email address shown as the sender in your email message. If you pass an empty string for email address, the email address stored in user.mailaddress is used.
"asg@erols.com"
toAddress(See note below on new feature of this parameter) is the email address of the intended recipient(s) and can be any one of the following Frontier data types (or an address pointing to one of these types):
- a
stringcontaining a single email address
"dwiner@well.com"
- a
stringcontaining several email addresses, separated by commas
"dwiner@well.com, asg@erols.com, leonardr@aladdinsys.com"Note that this is a common format for recipient lists in many electronic mail programs, like Eudora.
- a
listcontaining one or more strings that are single email addresses
{ "dwiner@well.com", "asg@erols.com", "leonardr@aladdinsys.com" }
- the address to a
tablecontaining one or more string objects that are single email addresses
An example of such a table might look like this:@scratchpad.recipientsNew in Version 1.0b7.3 - the
toAddressparameter can now be a list with up to three items. The items represent, in order, the "To:", "Cc:", and "Bcc:" addresses. Each item in the list can be any of the types listed above. To omit "Cc:" and include "Bcc:", use an empty string for the second item in the list:myRecipientList = {"you.somewhere.com", "", "bccRecip1.company.com"}
tcpcmd.sendMail("smtp.erols.com","asg@erols.com",myRecipientList, ...)
emailSubjectastringcontaining the text that will appear in the Subject line of your note.
"This is the Subject Line"
emailDatais the text of your message and can be one of the following Frontier data types, or an address pointing to, one of these types:Again, these various possibilities for the email message text help scripters implement their bulk mail applications.
- a
stringcontaining the message text
"This is the text of the message."- a
wpTextobject containing the message text
Note that here we are passing the address of a wpText object. We don't have to pass the address, though.@people.asg.myWPtextMessage- a
fileSpeccontaining the path to a text file containing the message text
fileSpec("Hard Drive:Desktop Folder:Message.txt")
mimetypean optionalstringcontaining the mime type of the message text. The default mimetype used is "text/plain". This parameter refers only to the message text and does not indicate an attachment.
timeoutan optionalnumbercontaining the number of seconds sendMail will wait for the smtp host at each step in the sending process before it gives up and returns to the caller. The default timeout used is defined in tcpcmd.timeouts.smtp.
Returns
trueif the message is sent- a script error stating the reason for failure
sendMail attempts to gracefully disconnect from the smtp host if an error occurs.Current Limitations and Restrictions
Attachments are not currently supported. Only the US-ASCII character set is supported in this version.
![]()
This page was last built on 9/16/98; 4:36:10 PM ET by Alan German, asg@erols.com. At the moment, I am using Macintosh OS to work on this website. The "Electric Cactus" graphic is based on original artwork owned by UserLand Software and is used with their permission.