User Tools

Site Tools


sending_20an_20email_20with_20attachments

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
sending_20an_20email_20with_20attachments [2018/03/31 13:19]
127.0.0.1 external edit
sending_20an_20email_20with_20attachments [2018/11/24 14:25]
richardrussell Fixed poorly-formatted link.
Line 2: Line 2:
  
 //by Richard Russell, October 2012, corrected August 2015//\\ \\  //by Richard Russell, October 2012, corrected August 2015//\\ \\ 
-==== See also [[/​Sending%20an%20HTML%20email%20with%20optional%20attachments|Sending an HTML email with optional attachments]] ​====+See also [[/​Sending%20an%20HTML%20email%20with%20optional%20attachments|Sending an HTML email with optional attachments]] 
 \\  In the article [[/​Sending%20an%20email%20automatically|Sending an email automatically]] the procedure **PROCsendmail()** automatically sends an email using the SOCKLIB library. Listed below is a procedure which performs the same function except that you can specify one or more files to attach to the email. The final parameter is a comma-separated list of the pathnames of the file(s) you wish to attach. The procedure might be called as follows:​\\ ​ \\  In the article [[/​Sending%20an%20email%20automatically|Sending an email automatically]] the procedure **PROCsendmail()** automatically sends an email using the SOCKLIB library. Listed below is a procedure which performs the same function except that you can specify one or more files to attach to the email. The final parameter is a comma-separated list of the pathnames of the file(s) you wish to attach. The procedure might be called as follows:​\\ ​
 +<code bb4w>
         INSTALL @lib$+"​SOCKLIB"​         INSTALL @lib$+"​SOCKLIB"​
  
Line 16: Line 18:
  
         PROCsendmailattach(SMTP$,​From$,​To$,"","",​Subject$,​ReplyTo$,​Message$,​Attach$)         PROCsendmailattach(SMTP$,​From$,​To$,"","",​Subject$,​ReplyTo$,​Message$,​Attach$)
 +</​code>​
 The calling program should first check that the attached files actually exist, because if not **PROCattach()** will abort with an error and not terminate the SMTP transaction;​ this could leave the server 'in limbo'​. **Note that if an attached file path contains spaces or punctuation characters you must enclose it in quotes**.\\ \\  Here is **PROCsendmailattach()**;​ like **PROCsendmail()** it cannot be used if authentication is required so in practice that probably means that your ISP's SMTP server must be used:​\\ ​ The calling program should first check that the attached files actually exist, because if not **PROCattach()** will abort with an error and not terminate the SMTP transaction;​ this could leave the server 'in limbo'​. **Note that if an attached file path contains spaces or punctuation characters you must enclose it in quotes**.\\ \\  Here is **PROCsendmailattach()**;​ like **PROCsendmail()** it cannot be used if authentication is required so in practice that probably means that your ISP's SMTP server must be used:​\\ ​
 +<code bb4w>
         DEF PROCsendmailattach(smtp$,​from$,​rcpt$,​cc$,​bcc$,​subject$,​replyto$,​body$,​attach$)         DEF PROCsendmailattach(smtp$,​from$,​rcpt$,​cc$,​bcc$,​subject$,​replyto$,​body$,​attach$)
         LOCAL D%, S%, skt%, comma%, reply$, file$         LOCAL D%, S%, skt%, comma%, reply$, file$
Line 142: Line 146:
         CLOSE #F%         CLOSE #F%
         ENDPROC         ENDPROC
 +</​code>​
sending_20an_20email_20with_20attachments.txt · Last modified: 2018/11/24 14:25 by richardrussell