sending_20an_20email_20automatically
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| sending_20an_20email_20automatically [2018/04/12 21:31] – richardrussell | sending_20an_20email_20automatically [2024/01/05 00:21] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| ===== Using an email client ===== | ===== Using an email client ===== | ||
| \\ The advantages of this method are that it's simple, requires no configuration and can work even with mail servers requiring authentication. The disadvantage is that the process is not fully automatic: the user still has to initiate transmission by clicking on **send**. It's therefore not suitable if you want to send an email covertly or without any user intervention.\\ \\ To adopt this method use code similar to the following: | \\ The advantages of this method are that it's simple, requires no configuration and can work even with mail servers requiring authentication. The disadvantage is that the process is not fully automatic: the user still has to initiate transmission by clicking on **send**. It's therefore not suitable if you want to send an email covertly or without any user intervention.\\ \\ To adopt this method use code similar to the following: | ||
| + | <code bb4w> | ||
| SYS " | SYS " | ||
| \ "? | \ "? | ||
| \ "& | \ "& | ||
| + | </ | ||
| Here **to$** is the email address of the main recipient, **subject$** is the subject line and **body$** is the body of the message. **to$** can optionally consist of two or more addresses separated by commas.\\ \\ If you want to **copy** the message to other recipients you can do that as follows: | Here **to$** is the email address of the main recipient, **subject$** is the subject line and **body$** is the body of the message. **to$** can optionally consist of two or more addresses separated by commas.\\ \\ If you want to **copy** the message to other recipients you can do that as follows: | ||
| + | <code bb4w> | ||
| SYS " | SYS " | ||
| \ "? | \ "? | ||
| \ "& | \ "& | ||
| \ "& | \ "& | ||
| + | </ | ||
| Again, **cc$** can optionally consist of two or more addresses separated by commas.\\ \\ If you prefer to **blind copy** the message (that is, the recipients don't know to whom other copies have been sent) replace **cc** with **bcc**:\\ \\ | Again, **cc$** can optionally consist of two or more addresses separated by commas.\\ \\ If you prefer to **blind copy** the message (that is, the recipients don't know to whom other copies have been sent) replace **cc** with **bcc**:\\ \\ | ||
| + | <code bb4w> | ||
| SYS " | SYS " | ||
| \ "? | \ "? | ||
| \ "& | \ "& | ||
| \ "& | \ "& | ||
| + | </ | ||
| If the body of the message consists of more than a single line then you must represent the line terminators in a special way. Rather than the conventional CRLF (CHR$13+CHR$10) you must use the character sequence "" | If the body of the message consists of more than a single line then you must represent the line terminators in a special way. Rather than the conventional CRLF (CHR$13+CHR$10) you must use the character sequence "" | ||
| + | <code bb4w> | ||
| DEF FNmailencode(A$) | DEF FNmailencode(A$) | ||
| LOCAL B$, I% | LOCAL B$, I% | ||
| Line 33: | Line 40: | ||
| NEXT I% | NEXT I% | ||
| =B$ | =B$ | ||
| + | </ | ||
| \\ | \\ | ||
| ===== 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: | \\ 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: | ||
| - | < | + | < |
| DEF PROCsendmail(smtp$, | DEF PROCsendmail(smtp$, | ||
| LOCAL D%, S%, skt%, reply$ | LOCAL D%, S%, skt%, reply$ | ||
sending_20an_20email_20automatically.1523568701.txt.gz · Last modified: 2024/01/05 00:16 (external edit)