Adding additional email

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
TSemmes
Forum Newbie
Posts: 1
Joined: Wed Jul 23, 2008 3:27 pm

Adding additional email

Post by TSemmes »

I maintain a website that has an online exam people can take. After completing the test, the user is sent an email that tells them if they passed the test or not. All we are trying to do is to add an additional email so that we get a copy of that email.

The test was created many ages ago. I have been adept in modifying the PHP file to reflect the changing answers but don't know much more than that.

I am assuming that somewhere in this code (see below) is where I could add an email. I thought if I took the line $EmailAddress = $_REQUEST["email"];

and modified it to read: $EmailAddress = $_REQUEST["email"], 'name@mysite.com'; it would also send an email to name@mysite.com. But it doesn't seem to work that way. Is this a quick fix I can make or something I need to have an expert do?

{
$name = $_REQUEST['first_name'] . ' ' . $_REQUEST['last_name'];
$EmailBody .= "On " . $TestDate . " \n";
$EmailBody .= $name . " passed the SVU Professional Performance DVD Series test \n";
$EmailBody .= $_REQUEST["test_name"] . " \n";
$EmailBody .= "with a score of " . $score . " percent. \n";
$EmailBody .= $name . " has earned 1 SVU-CME credit hour.\n\n";
$EmailBody .= "Please do not send your CME information to ARDMS unless you are audited. It is your responsibility to retain all of your CME records. ";
$EmailBody .= "DVD No." . $_REQUEST["SVUNO"] . " \n";

$EmailAddress = $_REQUEST["email"];
if (!mail($EmailAddress, "SVU Professional Performance DVD Series Test Results", $EmailBody, "From: web@svunet.org\n", "-ODeliveryMode=b")){


Thank you for your help.

Tom
manixrock
Forum Commoner
Posts: 45
Joined: Sun Jul 20, 2008 6:38 pm

Re: Adding additional email

Post by manixrock »

You can add multiple recipients to an email by entering them as a comma separated list in the first argument of the mail() function.

In your case, you can simply change:

Code: Select all

$EmailAddress = $_REQUEST["email"].', name@mysite.com';
Post Reply