You will have to figure out on your own how to get the user's address but if you want the code for how to send an email, you can use the phpmailer
as described in a walkthrough video and here, and the relative code is as follows:
the following code uses a gmail account to send the emails
<?php
require("libphp-phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Host = "smtp.gmail.com"; // change to your email host
$mail->Port = 587; // change to your email port
$mail->Username = "[email protected]"; // change to your username
$mail->Password = "myOneTimePasswordBecauseOfTwoStepAuth"; // change to your email password
$mail->setFrom("[email protected]"); // change to your email password
$mail->AddAddress("[email protected]"); // change to user's email address
$mail->Subject = "trial"; // change to email's subject
$mail->Body = "<h1>hello, world!</h1>"; // change to email's body, add the needed link here
if ($mail->Send() == false)
{
die($mail->ErrInfo);
}
else
{
echo "It worked!\n";
}
?>
If you want to send emails from the appliance itself I think you would have to install an email server, and that is probably an overkill for this course.
Edit
Common SMTP servers:
Gmail
- Gmail SMTP server name:
smtp.gmail.com
- Gmail SMTP user name:
your Google account
- Gmail SMTP password:
your Google password
- Gmail SMTP port:
587
Hotmail
- Hotmail SMTP server name:
smtp.live.com
- Hotmail SMTP user name:
your Hotmail account
- Hotmail SMTP password:
your Hotmail password
- Hotmail SMTP port:
25 or 465
Yahoo
- Yahoo! SMTP server address:
smtp.mail.yahoo.com
- Yahoo! SMTP user name:
your Yahoo! Mail account
- Yahoo! SMTP password:
your Yahoo! Mail password
- Yahoo! SMTP port:
465
Extra Info
Regarding the different ports (587 vs 465 vs 25) see this really helpful site