[TASK] Sending an Email (Simple Course)

[TASK] Sending an Email (Simple Course)

Postby admin » Mon Apr 25, 2016 2:42 pm

We will go through an example of sending an Email by PHPoC Blue.

This example is a simple course uses the SMTP library.

Source Codes
1. task0.php
Code: Select all


    exit; // avoid php execution via http request

include_once "/lib/sn_dns.php";
include_once "/lib/sn_smtp.php";

echo "PHPoC example : send email\r\n";

//smtp_setup(udp_id, tcp_id, "x.x.x.x");
//smtp_account("from_id@from_domain.com", "from_name");

$subject = "email test from PHPoC";
$message = "This is PHPoC test email\r\nGood bye\r\n";

$msg = smtp_send("to_id@to_domain.com", "to_name", $subject, $message);

$msg == "221")
    echo "send email successful\r\n";
    echo "send email failed\r\n";


How to use

1. Make sure that your PHPoC Blue is connected to the Internet.

2. Please download a PSP (PHPoC Support Package) of libraries and examples from PHPoC.

3. Connect PHPoC Blue to your PC via USB cable.

4. Run PHPoC Debugger.

5. Upload all libraries in PSP to your PHPoC Blue through PHPoC Debugger.
psp_email_eg_01.png (9 KiB) Viewed 4906 times

※ Note that the libraries should be located in the /lib folder.
psp_email_eg_02.png (8.84 KiB) Viewed 4906 times

6. Find an example of E-mail (SMTP) in the PSP.
psp_email_eg_03.png (10.83 KiB) Viewed 4906 times

7. Upload init.php and task0.php file to your PHPoC Blue.
※ Note that the libraries should be located in the root folder.
psp_email_eg_04.png (2.22 KiB) Viewed 4906 times

8. Modify the e-mail address and name to yours in task0.php file. (line number 18)
psp_email_eg_05.png (20.65 KiB) Viewed 4906 times

9. Upload the task0.php to your PHPoC Blue again.

10. Run the example.
psp_email_eg_06.png (52.24 KiB) Viewed 4906 times
Site Admin
Posts: 153
Joined: Mon Jan 20, 2014 4:40 pm

Return to Example

Who is online

Users browsing this forum: No registered users and 1 guest