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
jonnyfortis
Forum Contributor
Posts: 462 Joined: Tue Jan 10, 2012 6:05 am
Post
by jonnyfortis » Mon Feb 09, 2015 11:08 am
i have created an email from a website but when i try to view the email parts of the email image is missing even though the images are on the server
Code: Select all
<?php
$email_to = $row_rsEmail['email'];
$email_subject = "Wholesaler user details";
$thankyou_url = "http://www.wiizzyy.com/admin/SS15/ws-list-confirmed.php";
$name = $row_rsEmail['name'];//$_POST["name"];
$email_from = $row_rsEmail['email'];//$_POST["email"];
if(!filter_var($email_from, FILTER_VALIDATE_EMAIL)) {
// Invalid email address
die("The email address entered is invalid.");
}
$headers = "From: " . $email_from . "\r\n";
$headers .= "Reply-To: " . $email_from . "\r\n"; // (You can change the reply email address here if you want to.)
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$message = '<html>';
$message .= '<head>';
$message .= '<title>Wholesale Login Details</title>';
$message .= '</head>';
$message .= '<body>';
$message .= '<table style="display: inline-table;" border="0" cellpadding="0" cellspacing="0" width="671">';
$message .= '<tr>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="68" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="95" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="105" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="49" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="12" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="44" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="6" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="103" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="73" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="116" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="1" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td colspan="10"><img name="confirmation_r1_c1" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r1_c1.jpg" width="671" height="114" border="0" id="confirmation_r1_c1" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="114" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td rowspan="12"><img name="confirmation_r2_c1" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r2_c1.jpg" width="68" height="620" border="0" id="confirmation_r2_c1" alt="" /></td>';/////didnt load
$message .= '<td colspan="7">'. $row_rsEmail['name']. '</td>';
$message .= '<td rowspan="8" colspan="2"><img name="confirmation_r2_c9" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r2_c9.jpg" width="189" height="336" border="0" id="confirmation_r2_c9" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="29" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td colspan="7"><img name="confirmation_r3_c2" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r3_c2.jpg" width="414" height="123" border="0" id="confirmation_r3_c2" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="123" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td rowspan="10"><img name="confirmation_r4_c2" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r4_c2.jpg" width="95" height="468" border="0" id="confirmation_r4_c2" alt="" /></td>';
$message .= '<td colspan="6">' .$row_rsEmail['email']. '</td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="28" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td colspan="6"><img name="confirmation_r5_c3" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r5_c3.jpg" width="319" height="3" border="0" id="confirmation_r5_c3" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="3" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td colspan="6">' .$row_rsEmail['password']. '</td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="28" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td colspan="6"><img name="confirmation_r7_c3" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r7_c3.jpg" width="319" height="30" border="0" id="confirmation_r7_c3" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="30" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td colspan="6"><a href="http://www.wiizzyy.com/wholesale/"><img name="confirmation_r8_c3" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r8_c3.jpg" width="319" height="28" border="0" id="confirmation_r8_c3" alt="" /></a></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="28" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td colspan="6"><img name="confirmation_r9_c3" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r9_c3.jpg" width="319" height="67" border="0" id="confirmation_r9_c3" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="67" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td rowspan="2" colspan="4"><img name="confirmation_r10_c3" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r10_c3.jpg" width="210" height="58" border="0" id="confirmation_r10_c3" alt="" /></td>';
$message .= '<td colspan="3"><img name="confirmation_r10_c7" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r10_c7.jpg" width="182" height="22" border="0" id="confirmation_r10_c7" alt="" /></td>';
$message .= '<td rowspan="4"><img name="confirmation_r10_c10" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r10_c10.jpg" width="116" height="284" border="0" id="confirmation_r10_c10" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="22" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td colspan="3"><img name="confirmation_r11_c7" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r11_c7.jpg" width="182" height="36" border="0" id="confirmation_r11_c7" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="36" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td rowspan="2"><img name="confirmation_r12_c3" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r12_c3.jpg" width="105" height="226" border="0" id="confirmation_r12_c3" alt="" /></td>';//didnt load
$message .= '<td><a href="https://www.facebook.com/pages/wiizzyy/1000000000000" target="_new"><img name="confirmation_r12_c4" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r12_c4.jpg" width="49" height="48" border="0" id="confirmation_r12_c4" alt="" /></a></td>';
$message .= '<td rowspan="2"><img name="confirmation_r12_c5" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r12_c5.jpg" width="12" height="226" border="0" id="confirmation_r12_c5" alt="" /></td>';
$message .= '<td colspan="2"><a href="http://instagram.com/wiizzy" target="_new"><img name="confirmation_r12_c6" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r12_c6.jpg" width="50" height="48" border="0" id="confirmation_r12_c6" alt="" /></a></td>';
$message .= '<td rowspan="2" colspan="2"><img name="confirmation_r12_c8" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r12_c8.jpg" width="176" height="226" border="0" id="confirmation_r12_c8" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="48" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td><img name="confirmation_r13_c4" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r13_c4.jpg" width="49" height="178" border="0" id="confirmation_r13_c4" alt="" /></td>';
$message .= '<td colspan="2"><img name="confirmation_r13_c6" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r13_c6.jpg" width="50" height="178" border="0" id="confirmation_r13_c6" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="178" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '</table>';
$message .= '</body>';
$message .= '</html>';
//$message = "Name: ". $name . "\r\nMessage: " . $message;
// This is the important ini_set command which sets the sendmail_from address, without this the email won't send.
ini_set("sendmail_from", $email_from);
$sent = mail($email_to, $email_subject, $message, $headers, "-f" . $email_from);
// If the mail() function above successfully sent the mail, $sent will be true.
if($sent) {
header('Location: http://www.wiizzyy.com/admin/SS15/ws-list-confirmed.php'); // Redirect customer to thankyou page
} else {
// The mail didn't send, display an error.
echo "There has been an error sending your message. Please try later.";
}
?>
some of the images are not loading i have commented out a couple of the images that didnt load
jonnyfortis
Forum Contributor
Posts: 462 Joined: Tue Jan 10, 2012 6:05 am
Post
by jonnyfortis » Mon Feb 09, 2015 12:32 pm
jonnyfortis wrote: i have created an email from a website but when i try to view the email parts of the email image is missing even though the images are on the server
Code: Select all
<?php
$email_to = $row_rsEmail['email'];
$email_subject = "Wholesaler user details";
$thankyou_url = "http://www.wiizzyy.com/admin/SS15/ws-list-confirmed.php";
$name = $row_rsEmail['name'];//$_POST["name"];
$email_from = $row_rsEmail['email'];//$_POST["email"];
if(!filter_var($email_from, FILTER_VALIDATE_EMAIL)) {
// Invalid email address
die("The email address entered is invalid.");
}
$headers = "From: " . $email_from . "\r\n";
$headers .= "Reply-To: " . $email_from . "\r\n"; // (You can change the reply email address here if you want to.)
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$message = '<html>';
$message .= '<head>';
$message .= '<title>Wholesale Login Details</title>';
$message .= '</head>';
$message .= '<body>';
$message .= '<table style="display: inline-table;" border="0" cellpadding="0" cellspacing="0" width="671">';
$message .= '<tr>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="68" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="95" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="105" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="49" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="12" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="44" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="6" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="103" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="73" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="116" height="1" border="0" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="1" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td colspan="10"><img name="confirmation_r1_c1" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r1_c1.jpg" width="671" height="114" border="0" id="confirmation_r1_c1" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="114" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td rowspan="12"><img name="confirmation_r2_c1" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r2_c1.jpg" width="68" height="620" border="0" id="confirmation_r2_c1" alt="" /></td>';/////didnt load
$message .= '<td colspan="7">'. $row_rsEmail['name']. '</td>';
$message .= '<td rowspan="8" colspan="2"><img name="confirmation_r2_c9" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r2_c9.jpg" width="189" height="336" border="0" id="confirmation_r2_c9" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="29" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td colspan="7"><img name="confirmation_r3_c2" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r3_c2.jpg" width="414" height="123" border="0" id="confirmation_r3_c2" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="123" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td rowspan="10"><img name="confirmation_r4_c2" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r4_c2.jpg" width="95" height="468" border="0" id="confirmation_r4_c2" alt="" /></td>';
$message .= '<td colspan="6">' .$row_rsEmail['email']. '</td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="28" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td colspan="6"><img name="confirmation_r5_c3" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r5_c3.jpg" width="319" height="3" border="0" id="confirmation_r5_c3" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="3" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td colspan="6">' .$row_rsEmail['password']. '</td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="28" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td colspan="6"><img name="confirmation_r7_c3" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r7_c3.jpg" width="319" height="30" border="0" id="confirmation_r7_c3" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="30" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td colspan="6"><a href="http://www.wiizzyy.com/wholesale/"><img name="confirmation_r8_c3" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r8_c3.jpg" width="319" height="28" border="0" id="confirmation_r8_c3" alt="" /></a></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="28" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td colspan="6"><img name="confirmation_r9_c3" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r9_c3.jpg" width="319" height="67" border="0" id="confirmation_r9_c3" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="67" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td rowspan="2" colspan="4"><img name="confirmation_r10_c3" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r10_c3.jpg" width="210" height="58" border="0" id="confirmation_r10_c3" alt="" /></td>';
$message .= '<td colspan="3"><img name="confirmation_r10_c7" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r10_c7.jpg" width="182" height="22" border="0" id="confirmation_r10_c7" alt="" /></td>';
$message .= '<td rowspan="4"><img name="confirmation_r10_c10" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r10_c10.jpg" width="116" height="284" border="0" id="confirmation_r10_c10" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="22" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td colspan="3"><img name="confirmation_r11_c7" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r11_c7.jpg" width="182" height="36" border="0" id="confirmation_r11_c7" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="36" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td rowspan="2"><img name="confirmation_r12_c3" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r12_c3.jpg" width="105" height="226" border="0" id="confirmation_r12_c3" alt="" /></td>';//didnt load
$message .= '<td><a href="https://www.facebook.com/pages/wiizzyy/1000000000000" target="_new"><img name="confirmation_r12_c4" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r12_c4.jpg" width="49" height="48" border="0" id="confirmation_r12_c4" alt="" /></a></td>';
$message .= '<td rowspan="2"><img name="confirmation_r12_c5" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r12_c5.jpg" width="12" height="226" border="0" id="confirmation_r12_c5" alt="" /></td>';
$message .= '<td colspan="2"><a href="http://instagram.com/wiizzy" target="_new"><img name="confirmation_r12_c6" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r12_c6.jpg" width="50" height="48" border="0" id="confirmation_r12_c6" alt="" /></a></td>';
$message .= '<td rowspan="2" colspan="2"><img name="confirmation_r12_c8" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r12_c8.jpg" width="176" height="226" border="0" id="confirmation_r12_c8" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="48" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td><img name="confirmation_r13_c4" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r13_c4.jpg" width="49" height="178" border="0" id="confirmation_r13_c4" alt="" /></td>';
$message .= '<td colspan="2"><img name="confirmation_r13_c6" src="http://www.wiizzyy.com/wholesale/images/confirm/confirmation_r13_c6.jpg" width="50" height="178" border="0" id="confirmation_r13_c6" alt="" /></td>';
$message .= '<td><img src="http://www.wiizzyy.com/wholesale/images/confirm/spacer.gif" width="1" height="178" border="0" alt="" /></td>';
$message .= '</tr>';
$message .= '</table>';
$message .= '</body>';
$message .= '</html>';
//$message = "Name: ". $name . "\r\nMessage: " . $message;
// This is the important ini_set command which sets the sendmail_from address, without this the email won't send.
ini_set("sendmail_from", $email_from);
$sent = mail($email_to, $email_subject, $message, $headers, "-f" . $email_from);
// If the mail() function above successfully sent the mail, $sent will be true.
if($sent) {
header('Location: http://www.wiizzyy.com/admin/SS15/ws-list-confirmed.php'); // Redirect customer to thankyou page
} else {
// The mail didn't send, display an error.
echo "There has been an error sending your message. Please try later.";
}
?>
some of the images are not loading i have commented out a couple of the images that didnt load
i have looked at the code again and noticed missing parts to the links that are there in the script
for example in the email client the link says
but the actual code shows
so in the mail process some text is not eing carried through