Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Hidden
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING.		THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE

Using GMail
To connect to GMail the following settings supplied in the properties Array:

Code Block
var userName = 'xxx';
var passWord = 'yyy';
var properties = new Array();
properties[0] = 'mail.smtp.host=smtp.gmail.com';
properties[1] = 'mail.smtp.auth=true';
properties[2] = 'mail.smtp.username=' + userName;
properties[3] = 'mail.smtp.password=' + passWord;
properties[4] = 'mail.smtp.port=587';
properties[5] = 'mail.smtp.starttls.enable=true';


HTML Table
classservoy sReturnTypes
Table Row (tr)
styleheight: 30px;
Table Head (th)
Return Types
Table Row (tr)
Table Cell (td)
Span
classsWordList
Attachment
Span
classsWordList
MailMessage

HTML Table
classservoy sSummery
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Server Property Summery
Table Body (tbody)
Table Row (tr)
Table Cell (td)

Table Cell (td)
#mail.development.override.address
Table Body (tbody)
Table Row (tr)
Table Cell (td)

Table Cell (td)
#mail.from
Table Body (tbody)
Table Row (tr)
Table Cell (td)

Table Cell (td)
#mail.mime.charset
Table Body (tbody)
Table Row (tr)
Table Cell (td)

Table Cell (td)
#mail.pop3.apop.enable
Table Body (tbody)
Table Row (tr)
Table Cell (td)

Table Cell (td)
#mail.pop3.host
Table Body (tbody)
Table Row (tr)
Table Cell (td)

Table Cell (td)
#mail.server.allowUnauthenticatedRMIAccess
Table Body (tbody)
Table Row (tr)
Table Cell (td)

Table Cell (td)
#mail.smtp.auth
Table Body (tbody)
Table Row (tr)
Table Cell (td)

Table Cell (td)
#mail.smtp.connectiontimeout
Table Body (tbody)
Table Row (tr)
Table Cell (td)

Table Cell (td)
#mail.smtp.host
Table Body (tbody)
Table Row (tr)
Table Cell (td)

Table Cell (td)
#mail.smtp.password
Table Body (tbody)
Table Row (tr)
Table Cell (td)

Table Cell (td)
#mail.smtp.port
Table Body (tbody)
Table Row (tr)
Table Cell (td)

Table Cell (td)
#mail.smtp.ssl.enable
Table Body (tbody)
Table Row (tr)
Table Cell (td)

Table Cell (td)
#mail.smtp.timeout
Table Body (tbody)
Table Row (tr)
Table Cell (td)

Table Cell (td)
#mail.smtp.username

HTML Table
classservoy sSummery
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summery
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Attachment
Table Cell (td)
#createBinaryAttachment(filename, binarydata, [mimeType])
Creates a binary attachment object.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Attachment
Table Cell (td)
#createTextAttachment(filename, textdata, [mimeType])
Creates a text based attachment object.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getLastSendMailExceptionMsg()
Get the exception that occurred in the last sendMail attempt (null if no exception occurred).
Table Body (tbody)
Table Row (tr)
Table Cell (td)
MailMessage
Table Cell (td)
#getMailMessage(binaryblob/string)
Helper method, returns MailMessage object from binary or 7bits string.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String[]
Table Cell (td)
#getPlainMailAddresses(addressesString)
Helper method to only get the plain addresses.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
MailMessage[]
Table Cell (td)
#receiveMail(userName, password, leaveMsgsOnServer, [receiveMode], [onlyreceiveMsgWithSentDate], [overridePreferencePOP3Host/properties array])
Receive mails from pop3 account.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#sendMail([to[,to2,toN], [from[,reply], subject, msgText, [cc,cc2,ccN], [bcc,bcc2,bccN], [attachment/attachments array], [overridePreferenceSMTPHost/properties array])
Send a mail, if you make the msgText start with <html> the message will be sent in html (and you can use all html formatting).

HTML Table
idserverProperty
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Server Property Details
Table Body (tbody)
idmail.development.override.address
classnode
Table Row (tr)
idname
Table Cell (td)
mail.development.override.address
Table Row (tr)
iddes
Table Cell (td)
Specify an email address to which all email will be send instead of the specified To, Cc and Bcc addresses.
The specified to, Cc and Bcc addresses will be added to the Subject.
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmail.from
classnode
Table Row (tr)
idname
Table Cell (td)
mail.from
Table Row (tr)
iddes
Table Cell (td)
Default 'from' address if none is specified
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmail.mime.charset
classnode
Table Row (tr)
idname
Table Cell (td)
mail.mime.charset
Table Row (tr)
iddes
Table Cell (td)
Specify the name of the charset to use for mail encoding (leave emtpy for system default), see http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html forinfo which charset names are usable
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmail.pop3.apop.enable
classnode
Table Row (tr)
idname
Table Cell (td)
mail.pop3.apop.enable
Table Row (tr)
iddes
Table Cell (td)
Whether or not to use APOP for authentication (true/false), defaults to false.
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmail.pop3.host
classnode
Table Row (tr)
idname
Table Cell (td)
mail.pop3.host
Table Row (tr)
iddes
Table Cell (td)
The name of POP3 server to recieve mails from
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmail.server.allowUnauthenticatedRMIAccess
classnode
Table Row (tr)
idname
Table Cell (td)
mail.server.allowUnauthenticatedRMIAccess
Table Row (tr)
iddes
Table Cell (td)
Allow mailserver access for unauthenticated smart (rmi) client (true/false), defaults to false
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmail.smtp.auth
classnode
Table Row (tr)
idname
Table Cell (td)
mail.smtp.auth
Table Row (tr)
iddes
Table Cell (td)
Use authentication (true/false), defaults to false.
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmail.smtp.connectiontimeout
classnode
Table Row (tr)
idname
Table Cell (td)
mail.smtp.connectiontimeout
Table Row (tr)
iddes
Table Cell (td)
Socket connection timeout value in milliseconds. Default is infinite timeout.
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmail.smtp.host
classnode
Table Row (tr)
idname
Table Cell (td)
mail.smtp.host
Table Row (tr)
iddes
Table Cell (td)
The name of SMTP server to deliver the mails to
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmail.smtp.password
classnode
Table Row (tr)
idname
Table Cell (td)
mail.smtp.password
Table Row (tr)
iddes
Table Cell (td)
Specify password if using authentication
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmail.smtp.port
classnode
Table Row (tr)
idname
Table Cell (td)
mail.smtp.port
Table Row (tr)
iddes
Table Cell (td)
The port of SMTP server to deliver the mails to
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmail.smtp.ssl.enable
classnode
Table Row (tr)
idname
Table Cell (td)
mail.smtp.ssl.enable
Table Row (tr)
iddes
Table Cell (td)
Use SSL (true/false), defaults to false .
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmail.smtp.timeout
classnode
Table Row (tr)
idname
Table Cell (td)
mail.smtp.timeout
Table Row (tr)
iddes
Table Cell (td)
Socket I/O timeout value in milliseconds. Default is infinite timeout.
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmail.smtp.username
classnode
Table Row (tr)
idname
Table Cell (td)
mail.smtp.username
Table Row (tr)
iddes
Table Cell (td)
Specify username if using authentication
Table Row (tr)
classlastDetailRow
Table Cell (td)


HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
idcreateBinaryAttachment
classnode
Table Row (tr)
idname
Table Cell (td)
createBinaryAttachment
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Attachment
Span
stylefloat: left; font-weight: bold;
idiets
createBinaryAttachment
Span
stylefloat: left;
idiets
(filename, binarydata, [mimeType])
Table Row (tr)
iddes
Table Cell (td)
Creates a binary attachment object.
Table Row (tr)
idprs
Table Cell (td)
Parameters
filename
binarydata
[mimeType]
Table Row (tr)
idret
Table Cell (td)
Returns
Attachment
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var attachment1 = plugins.mail.createBinaryAttachment('logo1.gif',plugins.file.readFile('c:/temp/a_logo.gif'));
var attachment2 = plugins.mail.createBinaryAttachment('logo2.gif',plugins.file.readFile('c:/temp/another_logo.gif'));
var success = plugins.mail.sendMail('[email protected]', 'John Cobb <[email protected]>', 'subject', 'msgText',null,null,new Array(attachment1,attachment2));
if (!success) 
{
	plugins.dialogs.showWarningDialog('Alert','Failed to send mail','OK');
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idcreateTextAttachment
classnode
Table Row (tr)
idname
Table Cell (td)
createTextAttachment
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Attachment
Span
stylefloat: left; font-weight: bold;
idiets
createTextAttachment
Span
stylefloat: left;
idiets
(filename, textdata, [mimeType])
Table Row (tr)
iddes
Table Cell (td)
Creates a text based attachment object.
Table Row (tr)
idprs
Table Cell (td)
Parameters
filename
textdata
[mimeType]
Table Row (tr)
idret
Table Cell (td)
Returns
Attachment
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var attachment = plugins.mail.createTextAttachment('readme.html','<html>bla bla bla', 'text/html');
var success = plugins.mail.sendMail('[email protected]', 'John Cobb <[email protected]>', 'subject', 'msgText',null,null,attachment);
if (!success) 
{
	plugins.dialogs.showWarningDialog('Alert','Failed to send mail','OK');
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetLastSendMailExceptionMsg
classnode
Table Row (tr)
idname
Table Cell (td)
getLastSendMailExceptionMsg
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getLastSendMailExceptionMsg
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Get the exception that occurred in the last sendMail attempt (null if no exception occurred).
Table Row (tr)
idret
Table Cell (td)
Returns
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var success = plugins.mail.sendMail('[email protected],[email protected]', 'John Cobb <[email protected]>', 'subject', 'my message',null,'[email protected]');
if (!success) 
{
	plugins.dialogs.showWarningDialog('Alert',plugins.mail.getLastSendMailExceptionMsg(),'OK');
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetMailMessage
classnode
Table Row (tr)
idname
Table Cell (td)
getMailMessage
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
MailMessage
Span
stylefloat: left; font-weight: bold;
idiets
getMailMessage
Span
stylefloat: left;
idiets
(binaryblob/string)
Table Row (tr)
iddes
Table Cell (td)
Helper method, returns MailMessage object from binary or 7bits string.
Table Row (tr)
idprs
Table Cell (td)
Parameters
binaryblob/string
Table Row (tr)
idret
Table Cell (td)
Returns
MailMessage
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var msg = plugins.mail.getMailMessage(myColumn);
if (msg != null) //if is null error occurred!
{
	application.output(msg.getFromAddresses())
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetPlainMailAddresses
classnode
Table Row (tr)
idname
Table Cell (td)
getPlainMailAddresses
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String[]
Span
stylefloat: left; font-weight: bold;
idiets
getPlainMailAddresses
Span
stylefloat: left;
idiets
(addressesString)
Table Row (tr)
iddes
Table Cell (td)
Helper method to only get the plain addresses.
Table Row (tr)
idprs
Table Cell (td)
Parameters
addressesString
Table Row (tr)
idret
Table Cell (td)
Returns
String[]
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var plainArray = plugins.mail.getPlainMailAddresses('John Cobb <[email protected]>;Pete Cobb<[email protected]>');
application.output(plainArray[0]) //will return '[email protected]'
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idreceiveMail
classnode
Table Row (tr)
idname
Table Cell (td)
receiveMail
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
MailMessage[]
Span
stylefloat: left; font-weight: bold;
idiets
receiveMail
Span
stylefloat: left;
idiets
(userName, password, leaveMsgsOnServer, [receiveMode], [onlyreceiveMsgWithSentDate], [overridePreferencePOP3Host/properties array])
Table Row (tr)
iddes
Table Cell (td)
Receive mails from pop3 account.
Table Row (tr)
idprs
Table Cell (td)
Parameters
userName
password
leaveMsgsOnServer
[receiveMode]
[onlyreceiveMsgWithSentDate]
[overridePreferencePOP3Host/properties array]
Table Row (tr)
idret
Table Cell (td)
Returns
MailMessage[]
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var msgs = plugins.mail.receiveMail('me', 'test', true);
if (msgs != null) //if is null error occurred!
{
	for (var i = 0 ; i < msgs.length ; i++)
	{
		var msg = msgs[i]
		application.output(msg.getFromAddresses())
		application.output(msg.getRecipientAddresses())
		application.output(msg.getReplyAddresses())
		application.output(msg.getReceivedDate())
		application.output(msg.getSentDate())
		application.output(msg.getHeaders())
		application.output(msg.getSubject())
		application.output(msg.getHtmlMsg())
		application.output(msg.getPlainMsg())
		var attachments = msg.getAttachments()
		if (attachments != null) 
		{
			for (var j = 0 ; j < attachments.length ; j++)
			{
				var attachment = attachments[j]
				application.output(attachment.getName())
				var attachmentDataByteArray = attachment.getData()
				//write attachmentDataByteArray to a file...
			}
		}
	}
}

//it is also possible to first receive the headers and later receive a full message with particular 'sentdate'
//var receiveMode = 1;//0=FULL,1=HEADERS_ONLY,2=NO_ATTACHMENTS
//var msgs = plugins.mail.receiveMail('me', 'test', true ,receiveMode);

//when first did receive the headers(=all_field+subject,no body and no attachemnt), get a msg with a specific sentdate
//var msgs = plugins.mail.receiveMail('me', 'test', true , 1 , theSentDateObjectFormPreviousHeaderLoading);

//it is possbile to set all kind of pop3 properties
//var properties = new Array()
//properties[0] = 'mail.pop3.host=myserver.com'
//properties specification can be found at:http://java.sun.com/products/javamail/javadocs/com/sun/mail/pop3/package-summary.html
//var msgs = plugins.mail.receiveMail('me', 'test', true , 0 , null, properties);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsendMail
classnode
Table Row (tr)
idname
Table Cell (td)
sendMail
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
sendMail
Span
stylefloat: left;
idiets
([to[,to2,toN], [from[,reply], subject, msgText, [cc,cc2,ccN], [bcc,bcc2,bccN], [attachment/attachments array], [overridePreferenceSMTPHost/properties array])
Table Row (tr)
iddes
Table Cell (td)
Send a mail, if you make the msgText start with <html> the message will be sent in html (and you can use all html formatting).
Table Row (tr)
idprs
Table Cell (td)
Parameters
[to[,to2,toN]
[from[,reply]
subject
msgText
[cc,cc2,ccN]
[bcc,bcc2,bccN]
[attachment/attachments array]
[overridePreferenceSMTPHost/properties array]
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var attachment1 = plugins.mail.createBinaryAttachment('embedded',plugins.file.readFile('c:/temp/a_logo.gif'));
var msgText = 'plain msg<html>styled html msg<img src="%%embedded%%"></html>';
var success = plugins.mail.sendMail('[email protected],[email protected]', 'John Cobb <[email protected]>', 'subject', msgText,null,'[email protected]',[attachment1]);
if (!success) 
{
	plugins.dialogs.showWarningDialog('Alert','Failed to send mail','OK');
}

//it is possbile to set all kind of smtp properties
//var properties = new Array()
//properties[0] = 'mail.smtp.host=myserver.com'
//properties specification can be found at:http://java.sun.com/products/javamail/javadocs/com/sun/mail/smtp/package-summary.html
//var msgs = plugins.mail.sendMail('[email protected],[email protected]', 'John Cobb <[email protected]>', 'subject', msgText,null,'[email protected]',null, properties);
Table Row (tr)
classlastDetailRow
Table Cell (td)