Hi,
I am well able to send a normal email but am having problem trying to add an attachment (Logo image) and a link to pay for the service.
But after a good amount of research i came to a solution to add header mime types. I've tried to implement the code into my original code but could not get it to work.
My original code without the mime types is:
$to="me@mycomapny.com";
$inquiry=$_POST['inquiry'];
$first_name=$_POST['first_name'];
$last_name=$_POST['last_name'];
$email=$_POST['email'];
$getcopy=$_POST['getcopy'];
$headers=$_POST['email'];
$header1= "Hi,\r\n" .
"Order purchased: " . $_POST['inquiry'] . "\r\n" .
"First Name: " . $_POST['first_name'] . "\r\n" .
"Last Name: " . $_POST['last_name'] . "\r\n" .
"E-mail: " . $_POST['email'];
$header2="From: " . $email . "\r\n" .
"Customer Hosting Order: " . $_POST['inquiry'] . "\r\n" .
"First Name: " . $_POST['first_name'] . "\r\n" .
"Last Name: " . $_POST['last_name'] . "\r\n" .
"E-mail: " . $_POST['email'];
$error = "";
$errorflag = "";
if (($first_name == "") || ($last_name == "") || ($email == "")) {
$error = "<span class='colorTextBlue'>Please fill in all fields!</span>";
}
else {
if (ctype_alpha($first_name) == FALSE) {
$error = "<span class='colorTextBlue'>Please enter a valid First Name <span class='italic'>(Alphabets only)</span></span>";
$errorflag="first_name";
}
// Validate Last Name (including ERRORS such as (1) field left BLANK (2) field with INVALID data entered
else if (ctype_alpha($last_name) == FALSE) {
$error = "<span class='colorTextBlue'>Please enter a valid Surname <span class='italic'>(Alphabets only)</span></span>";
$errorflag="last_name";
}
// Validate E-mail (including ERRORS such as (1) field left BLANK (2) field with INVALID data entered
else if ((strpos($email, "@") == FALSE) || (strpos($email, ".") == FALSE) || (strpos($email, " ") != FALSE)) {
$error = "<span class='colorTextBlue'>Please enter a valid E-mail</span>";
$errorflag="email";
}
}
if ($error != "") {
echo "<br/> <b><span class='colorTextRed'>Error Occured: </b>" . $error."</span>" ;
}
else if (mail($to, $inquiry, $header2))
{
echo "<p><span class='colorTextBlue'>Order Settings:</span></p>";
echo "<table border=\"0\" width=\"100%\" cellpadding=\"4\" cellspacing=\"1\" class=\"formTable\">";
echo "<tbody>";
echo "<tr>";
echo "<th width=\"35%\"><b>Order Details:</b></th>";
echo "<td width=\"65%\">" . $inquiry . "</td>";
echo "</tr>";
echo "<tr>";
echo "<th width=\"35%\"><b>E-mail:</b></th>";
echo "<td width=\"65%\">" . $email . "</td>";
echo "</tr>";
echo "</tbody>";
echo "</table>";
}
else {
$error = "<span class='colorTextRed'> There was an error in your order. Please go back and fix this error.</span>";
}
if ($getcopy=="1") {
mail($email, $inquiry, $header1, "From:\"$bbtitle My Company\" <$to>");
}
}
else {
$inquiry = "";
$first_name = "";
$last_name = "";
$email = "";
$errorflag = "";
}
Can you please help with this as i've been trying for a week now and its been a big struggle. I have no idea how i'm going to add the mime types.
One thing i do not want is msg's like:
"X-Mailer: PHP/".phpversion() ."\r\n".
"MIME-Version: 1.0" . "\r\n".
"Content-Type: multipart/alternative; boundary=--$boundary". "\r\n".
"Content-Transfer-Encoding: 7bit". "\r\n";
I will be very grateful to whoever helps me with this.