Problem: How can I attach a Powerpoint file to an email when testing SMTP? Resolution: The following solution shows how a text file can be attached to an email being sent using SMTP: How do I customize my SMTP email script so that on replay I can read in a file and post this off to the email recipient? The data sent in the example script from the above link is as plain text, therefore will not allow you to attach a powerpoint file. However after making the following changes the email will send a Powerpoint attachment: * Change Content-Type to "application/vnd.ms-powerpoint" as per http://www.w3schools.com/media/media_mimeref.asp * Then encoded the binary data in "sData" to Base64 and sent the file encoded in "sEncoded". See the attached file - (Please visit the site to view this file) which will send the powerpoint file c:\temp\email.ppt as an email attachment. With the attached script do the following: * Replace 1 occurrence of "Enter Mail Server" with the "name of your mail server" * Replace 5 occurrences of "Enter Email Address" with the "email address of the user" * Create or rename a powerpoint file as c:\temp\email.ppt After performing the above steps, run the script and it should send an email from the user to that user with the specified powerpoint file. You will need to understand the script and amend the Content-Type to be able to send different file types. Please note that the string sizes have been manually set in the attached Email Powerpoint_attachement.bdf script - if you want to send a file bigger then 2 MB you will have to increase the string size (sMessage, sData, etc). Old KB# 29560
↧