Email sender (SMTP) using PIC18F27J53 and W5200

<< Introduction in Japanese >>

WIZ820io (W5200) でインターネット接続する実験ボードを用いて、2017年4月29日の稿で記したショート・メール送信の動作確認実験を行った。

The Ethernet board was previously reported in my page on Sep. 1, 2017.

If the switch (BUTTON0) is pushed and released, the massage will be send to the preset address using SMTPDemo.c.

<< Sample code of E-mail sender with 5200 >>


(Compiled by the C18 under the large code model on the MPLAB X IDE)

In TCPIPConfig.h, STACK_USE_SMTP_CLIENT, STACK_USE_DNS and STACK_USE_TCP must be defined.

Example above:
NetBIOS Name = PIC18F27J53
Default MAC address = {0x00, 0x04, 0xA3, 0x00, 0x00, 0x00}
Default IP address  = 192.168.1.10
Default subnet mast = 255.255.255.0
Default primary DNS = 192.168.1.1
Default secondary DNS = 0.0.0.0

In SMTP.c, a SMTP port must be defined to be appropriate for your Internet Service Provider.  In my project,  the message submission Port(587) of the SMTP server is used.

In SMTPDemo.c, your data must be set adequately to the arrays bellow.
RAMStringTo[] = ” @ “;    <—  Destination mail address
RAMStringBody[] = “***”;    <—  Short character string
SMTPClient.Server.szROM = (ROM BYTE*)”***”;
SMTPClient.Username.szROM = (ROM BYTE*)”***”;
SMTPClient.Password.szROM = (ROM BYTE*)”***”;
SMTPClient.From.szROM = (ROM BYTE*)”\”SMTP Service\” < @ >”;    < —  Sender mail address
SMTPClient.Subject.szROM = (ROM BYTE*)”***”;    <—  E-mail tittle

(SMTPDemo.c ファイルに契約プロバイダのアカウント、宛先メール・アドレス、メール・タイトル、メール本文を設定。SMTP.c ファイルに SMTP ポートを設定。)

<< Summary in Japanese >>

SMTPDemo.c が作動するように WIZnet 社の W5200 hardwired TCP/IP driver を修正するのに、プロなら忽ちである所を、素人なので時間が掛かってしまった。WIZnet 社自身も W5200 が PIC マイコンで積極的に利用されるとは考えていないのか driver もやっつけ仕事である。逆に言うと、素人工作の教材対象としての存在価値はある。