Lasso Soft Inc. > Home

[ email_compose->addAttachment ]

Method

[email_compose->addAttachment] adds a new attachment to a message being composed. The tag requires either both the -data and -name parameters or the -path parameter.

The -data parameter should specify the data of the file to be attached. This data will be automatically Base64 encoded before being placed in the message. The -name parameter specifies the name for the attached file.

Instead the -path parameter can be used to specify the location of a file that will be included as the attachment. If the -path parameter is specified then the name will be automatically set to the name of the file.

  • Syntax
email_compose->addAttachment(-data='data', -name='attached.txt')

email_compose->addAttachment(-path='include.txt')
Examples
  • Beginner

Attaching the same picture twice

The code below will attach the same picture in two different way. The email that it produces will have the picture attached twice.

Code

var(my_msg) = email_compose(-to='to@example.org', -from='from@example.com', -subject='Find Me')
$my_msg->addTextPart(-data='# Lost Rhino!')
$my_msg->addAttachment(-data=include_raw('/img/poster.png'), -name='poster1.png')
$my_msg->addAttachment(-path='/img/poster.png')

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft