I am trying to send an email to admin once the user clicks submit button on the registration page. The code given below works fine and I get all the details on the admin email address. I am stuck at two places:
- I want to send a CC to superadmin@mywebsite.com too. I tried putting a comma in the variable like
$receiver = "admin@mywebsite.com,superadmin@mywebsite.com";
but it does not work. The mail does not get sent. Need to know how to send this email to two different people. $panph1
variable returns a filename on the server (1467896354.jpg in this example). It displays the filename in the email body along with all other data. This file is stored at /pancard/1467896354.jpg - What changes I should make to get the actual file attached with this email.
Thanks
$subject = "New registration from $name ";
$receiver = "admin@mywebsite.com";
$prod_id1=$rowcc['prod_id'];
$mobile1=$rowcc['mobile'];
$reg=$rowcc['reg_date'];
$ip1=$rowcc['ip'];
$panno1=$rowcc['pan_no'];
$panph1=$rowcc['pan_photo'];
$message = "
<html>
<body>
<table>
<tr>
<td>Product ID</td>
<td>:</td>
<td>$prod_id1</td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td>$name</td>
</tr>
<tr>
<td>Email Address</td>
<td>:</td>
<td>$to</td>
</tr>
<tr>
<td>Mobile</td>
<td>:</td>
<td>$mobile1</td>
</tr>
<tr>
<td>Registration Date</td>
<td>:</td>
<td>$reg</td>
</tr>
<tr>
<td>IP Address</td>
<td>:</td>
<td>$ip1</td>
</tr>
<tr>
<td>Pan Card Number</td>
<td>:</td>
<td>$panno1</td>
</tr>
<tr>
<td>Pan Card Photo</td>
<td>:</td>
<td>$panph1</td>
</tr>
</table>
</body>
</html>
";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From:'.$from."\r\n"
.'Reply-To: $receiver'."\r\n";
mail($receiver,$subject, $message, $headers);