BE_SMTPAddAttachment ( { attachment ; contentType } )

Stores a list of attachment files from container fields as attachments for future BE_SMTPSend functions.


Version : 3.3
4.0 Changed the container parameter to attachment and added the contentType parameter.
4.0.2 : Renamed from BE_SMTP_AddAttachment


Parameters : 
attachment : a container field or a path to a file.
contentType : a mime content type, examples below.


Use this function to add attachments to an outgoing email that would normally be sent via BE_SMTPSend, but are not on disk.  You can add multiple attachments by calling this multiple times.  Once BE_SMTPSend is done it clears out the list of stored attachments regardless of the success of the Send.

Attachments are actually written to disk by the plugin, to the users temp folder, so this does require you to have access to a working temp folder ( defined by the OS ).


Example :

BE_SMTPAddAttachment ( Table::PDF_Field ; "application/pdf; charset=UTF-8")
BE_SMTPAddAttachment ( Table::File_Field ; "text/plain; name=\"file.txt\"")
BE_SMTPSend ( $from ; $to ; $subject ; $text ) //no attachments included here as they are added from the 2 previous steps.


Result : 0 for success or ? for an error.  Check the BE_CurlTrace function for error details.


Notes : The content type is what is set in the mime type for emails.  So usually something like :

Content-Type: application/pdf; charset=UTF-8
Content-Type: text/plain; name="file.txt"
Content-Type: application/octet-stream; name="file.pdf"


Still need help? Contact Us Contact Us