User Tools

Site Tools


sending_20an_20email_20automatically

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
sending_20an_20email_20automatically [2018/04/10 20:20]
richardrussell old revision restored
sending_20an_20email_20automatically [2018/04/13 00:42]
richardrussell
Line 2: Line 2:
  
 //by Richard Russell, October 2006//\\ \\  //by Richard Russell, October 2006//\\ \\ 
-==== See also [[/​Sending%20an%20email%20with%20attachments|Sending an email with attachments]] and [[/​Sending%20an%20HTML%20email%20with%20optional%20attachments|Sending an HTML email with optional attachments]] ​====+See also [[/​Sending%20an%20email%20with%20attachments|Sending an email with attachments]] and [[/​Sending%20an%20HTML%20email%20with%20optional%20attachments|Sending an HTML email with optional attachments]] 
 \\  There are two principal ways of automating the process of sending an email message: utililising the resources of the user's existing email client (e.g. Outlook or Eudora) or doing it entirely with BBC BASIC code.\\ \\  \\  There are two principal ways of automating the process of sending an email message: utililising the resources of the user's existing email client (e.g. Outlook or Eudora) or doing it entirely with BBC BASIC code.\\ \\ 
 ===== Using an email client ===== ===== Using an email client =====
Line 34: Line 35:
 \\  \\ 
 ===== Using BBC BASIC code ===== ===== Using BBC BASIC code =====
-\\  This approach gives you more control over the content of the email, and allows you to send it without any user interaction (assuming there is an internet connection). However there are a couple of disadvantages:​ you need to know the name (or IP address) of the SMTP server to be used, and it cannot work with a server which requires authentication. In practice this usually means you need to use **//the '​local'​ SMTP server provided by the ISP supplying the internet connection//​**. There is, as far as I know, no way of discovering this automatically.\\ \\  You can send an email using the procedure below. The **to$**, **cc$**, **bcc$**, **subject$** and **body$** parameters have the same meaning as in the previous example, except that there'​s no need to do any special encoding of the message body. The **smtp$** parameter is the name of the SMTP server (as discussed above), **from$** is the email address of the sender (which must be valid) and **replyto$** is an optional address to which replies should be addressed.\\ \\  The code uses the [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwing.html#​socklib|SOCKLIB library]] so there must be an **"​INSTALL @lib$+"​SOCKLIB""​** statement previously in the program.\\ \\ +\\  This approach gives you more control over the content of the email, and allows you to send it without any user interaction (assuming there is an internet connection). However there are a couple of disadvantages:​ you need to know the name (or IP address) of the SMTP server to be used, and it cannot work with a server which requires authentication. In practice this usually means you need to use **//the '​local'​ SMTP server provided by the ISP supplying the internet connection//​**. There is, as far as I know, no way of discovering this automatically.\\ \\  You can send an email using the procedure below. The **to$**, **cc$**, **bcc$**, **subject$** and **body$** parameters have the same meaning as in the previous example, except that there'​s no need to do any special encoding of the message body. The **smtp$** parameter is the name of the SMTP server (as discussed above), **from$** is the email address of the sender (which must be valid) and **replyto$** is an optional address to which replies should be addressed.\\ \\  The code uses the [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwing.html#​socklib|SOCKLIB library]] so there must be an **"​INSTALL @lib$+"​SOCKLIB""​** statement previously in the program. 
 + 
 +<code test68> ​
         DEF PROCsendmail(smtp$,​from$,​to$,​cc$,​bcc$,​subject$,​replyto$,​body$)         DEF PROCsendmail(smtp$,​from$,​to$,​cc$,​bcc$,​subject$,​replyto$,​body$)
         LOCAL D%, S%, skt%, reply$         LOCAL D%, S%, skt%, reply$
Line 121: Line 124:
         ENDWHILE         ENDWHILE
         ENDPROC         ENDPROC
 +</​code>​
 +
sending_20an_20email_20automatically.txt · Last modified: 2018/04/17 18:40 by tbest3112