![]() We’ll send the message using the built-in smtplib Python module. There are certain steps that need to be followed to do this correctly. This protocol specifies how computers can deliver emails to each other. To send emails, our computers use the Simple Mail Transfer Protocol (SMTP). The message body is still there as a "text/plain" part, and the image attachment is an "image/png" part. /usr/bin/ksh export MAILFROM'' export MAILTO'' export SUBJECT'Test PDF for Email' export BODY'/home/el/emailbody.htm' export ATTACH'/home/el/pdf-test.pdf' export MAILPARTuuidgen Generates Unique ID export MAILPARTBODYuuidgen Generates Unique ID ( echo 'From: MAILFROM' echo 'To: MAILTO' echo 'Subject: SUBJECT' echo 'MIME-Version: 1.0' echo 'Content-Type: multipart/mixed boundary\'MAILPART\'' echo '' echo '-MAILPART' echo 'Content. Each part of the message has its own MIME type. The email message as a whole has the MIME type "multipart/mixed". ![]() The entire message can be serialized as a text string, including the image that we attached. Content-Type: multipart/mixed boundary= "=5350123048127315795=" -= 5350123048127315795= Content-Type: text/plain charset= "utf-8" Content-Transfer-Encoding: 7bit Hey there! I 'm learning to send email using Python! -= 5350123048127315795= Content-Type: image/png Content-Transfer-Encoding: base64 Content-Disposition: attachment filename= "image.png" MIME-Version: 1.0 iVBORw0KGgoAAAANSUhEUgAAASIAAABSCAYAAADw69nDAAAACXBIWXMAAAsTAAALEwEAmpwYAAAg AElEQVR4nO2dd3wUZf7HP8/M9k2nKIJA4BCUNJKgNJWIBUUgEggCiSgeVhA8jzv05Gc5z4KHiqin eBZIIBDKIXggKIeCRCAhjQAqx4UiCARSt83uzDy/PzazTDZbwy4BnHde 9qZydNn97Pf5/uUIZRS (.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |