attachment with mail()
Posted: Wed Apr 20, 2011 3:01 pm
Hey guys, I have an e-mail script that has contact info and a png image that's in a base64 string posted to the script. How do i get the image as a attachment to the e-mail? the code is below and thanks in advance.
Code: Select all
<?php
$senderName = $_POST['senderName'];
$senderEmail = $_POST['senderEmail'];
$sendToEmail = "me@example.com";
$subject = $_POST['emailSubject'];
$emailMessage = $_POST['emailMessage'];
$senderPhone = $_POST['senderPhone'];
$senderStreet = $_POST['senderStreet'];
$senderCity = $_POST['senderCity'];
$senderZip = $_POST['senderZip'];
$base64data =$_POST['base64data'];
$recipient = "$sendToEmail";
$headers = "From: $senderEmail ";
$message = "From: $senderName, \nPhone: $senderPhone\nEmail Address: $senderEmail\nStreet: $senderStreet\nCity: $senderCity\nZip: $senderZip\nSubject: $subject\n\nMessage: $emailMessage\n\n $base64data";
$message = stripslashes($message);
mail($recipient, $subject, $message, $headers)
?>