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/11 17:32]
richardrussell
sending_20an_20email_20automatically [2018/04/13 00:42]
richardrussell
Line 37: Line 37:
 \\  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 ​bbc+<​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$
sending_20an_20email_20automatically.txt ยท Last modified: 2018/04/17 18:40 by tbest3112