Hi.
I use the mail() function to send out am email.
When I put a simple and short string the bodymail, I get the letter.
When I put a very long HTML code, I get nothing. I tried first escaping the string with addslashes(), but it again didn't work.
I get no errors evem when I put
PHP Code:
error_reporting(E_ALL);
, smiply the message is not sent!
Do you have any ideas?
Here goes the HTML string I use in the code:
Code:
<table width="650" cellspacing="0" cellpadding="0" border="0" align="center">
<tbody>
<tr>
<td bgcolor="#eee6d9" colspan="5">
<p style="color: rgb(153, 0, 0); font-family: Verdana,Geneva,sans-serif; font-size: 11px; padding-left: 15px;">You have got an Iquiry from one of our costumers<br />
If you are having trouble reading this email please log in to your account<a style="font-family: Verdana,Geneva,sans-serif; color: rgb(56, 74, 134); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">.</a></p>
</td>
<td><img height="56" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
</tr>
<tr>
<td bgcolor="#f7f2e6" colspan="3"><img height="55" width="442" border="0" alt="" id="n08mcburgundy_r2_c1" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/08-mc-burgundy_r2_c1.png" name="n08mcburgundy_r2_c1" /></td>
<td bgcolor="#f7f2e6" colspan="2"><img height="55" width="208" border="0" alt="Your Company Logo" id="n08mcburgundy_r2_c4" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/logo.png" name="n08mcburgundy_r2_c4" /></td>
<td><img height="55" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
</tr>
<tr>
<td height="31" width="647" bgcolor="#f7f2e6" colspan="5"><a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px; padding-left: 15px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Subscribe</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Back Issues</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Article Archive</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Resource Center</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Request Demo</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">example.com</a></td>
<td><img height="31" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
</tr>
<tr>
<td bgcolor="#f7f2e6"> </td>
<td valign="top" bgcolor="#f7f2e6">
<h1 style="font-family: Arial,Helvetica,sans-serif; color: rgb(146, 139, 119); font-size: 18px;">IN THIS ISSUE:</h1>
<h2> </h2>
<font color="#808080"><span style="font-weight: bold;">
<h2>Hello {{firstname}} {{lastname}},</h2>
<h2>You have an inquiry from {{country}} on your property.</h2>
<h2>The following is added.</h2>
<h2>Arrival date {{arrival_date}}</h2>
<h2>Departure date {{departure_date}}</h2>
<h2>Total party size {{with_children}}</h2>
<h2>with {{only_children}} Children</h2>
</span><br />
</font>
<p><a style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(153, 0, 0); font-weight: bold;" href="http://4homesonly.com" target="_blank">Please check the availability of your property here:</a><br />
</p>
<p style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(153, 0, 0); font-weight: bold;">MESSAGE:<br />
<br />
{{message}}<a style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; text-align: right; color: rgb(153, 0, 0);" href="mailto:address@email.com"><br />
</a></p>
</td>
<td colspan="2"> </td>
<td height="380" width="28" bgcolor="#f7f2e6"><a href="/userfiles/image/Active holiday Boy with fish.jpg"><img height="342" width="232" src="/userfiles/image/Active holiday Boy with fish.jpg" alt="boy" /></a></td>
<td><img height="380" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
</tr>
<tr>
<td bgcolor="#f7f2e6" rowspan="2"> </td>
<td bgcolor="#f7f2e6" colspan="3">
<h1 style="font-family: Tahoma,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 14px; font-weight: bold;">Featured Products</h1>
<p style="color: rgb(146, 139, 119); font-size: 12px; font-family: arial,verdana,sans-serif;">Lorem ipsum dolor sit amet, consect etuer adip iscing elit. Phasellus dui non magna commodo nascetur ridiculus volutpat porttitor. <br />
Ullamcorper sed, lobortis pretium, mi. Lorem ipsum dolor sit amet, consect etuer adip iscing elit. Phasell.</p>
</td>
<td height="407" width="28" bgcolor="#f7f2e6" rowspan="2"> </td>
<td><img height="124" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
</tr>
<tr>
<td valign="top" bgcolor="#f7f2e6" colspan="3">
<h1 style="font-family: arial,verdana,sans-serif; color: rgb(153, 0, 0); font-size: 14px; font-weight: bold;">Email Admin Center</h1>
<p style="font-family: arial,verdana,sans-serif; color: rgb(146, 139, 119); font-size: 12px;">This newsletter is a service of Example.com. Should you no longer wish to receive these messages please go here to unsubscribe or send an email to: unsubscribe-929@example.com <br />
<br />
To ensure delivery of this newsletter to your inbox and to enable images to load in future mailings, please add admincenter@example.com to your e-mail address book or safe senders list. You are receiving this email at yourname@example.com.<br />
<a style="font-family: Tahoma,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 12px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#"><br />
Update Your Profile</a> | <a style="font-family: arial,verdana,sans-serif; color: rgb(153, 0, 0); font-size: 12px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Web Version</a> | <a style="font-family: arial,verdana,sans-serif; color: rgb(153, 0, 0); font-size: 12px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Subscribe to Name</a></p>
</td>
</tr>
</tbody>
</table>
Can you show us the php mail headers you are using. In order to effectively get html into an email message using mail() you will need to have the proper multipart structure and mime settings.
We can take a look by starting with your php sendmail script.
/*
* I pulled this out of a function and dumbed it down a bit (keeping it basic) -- just populate
* all the $GLOBALS and you'll be good to go. Here's the $GLOBALS list:
* $GLOBALS['recipientsName'] :: name of person to receive message (optional)
* $GLOBALS['recipientsEmailAddress'] :: email address of person to receive message
* $GLOBALS['fromName'] :: name of person sending message (optional)
* $GLOBALS['fromEmailAddress'] :: email address of person sending message
* $GLOBALS['replyToName'] :: reply to persons name (optional)
* $GLOBALS['replyToEmailAddress'] :: reply to email address (can be different from sender's email address)
* $GLOBALS['ccList'] :: list of email address for cc purposes (optional) -- separate by commas
* $GLOBALS['bccList'] :: list of email address for bcc purposes (optional) -- separate by commas
* $GLOBALS['attachment'] :: file attachment (optional)
* $GLOBALS['plainTextVersion'] :: the plain text version of the message
* $GLOBALS['htmlVersion'] :: the html equivalent version of the message
* $GLOBALS['applicationType'] :: application mime type (optional)
* 'application/msword' for doc and docx files
* 'application/vnd.ms-excel' for csv, xls and xlsx files
* 'application/pdf' for pdf files
* this is all I have tested
* $GLOBALS['attachFileName'] :: name of file attachment (optional)
* $GLOBALS['subject'] :: message subject
*/
P.S. you might wish to edit the title of this thread and add "HTML" to it just in case others search this forum with similar issues. Good luck. Let us know how you make out.
/*
* I pulled this out of a function and dumbed it down a bit (keeping it basic) -- just populate
* all the $GLOBALS and you'll be good to go. Here's the $GLOBALS list:
* $GLOBALS['recipientsName'] :: name of person to receive message (optional)
* $GLOBALS['recipientsEmailAddress'] :: email address of person to receive message
* $GLOBALS['fromName'] :: name of person sending message (optional)
* $GLOBALS['fromEmailAddress'] :: email address of person sending message
* $GLOBALS['replyToName'] :: reply to persons name (optional)
* $GLOBALS['replyToEmailAddress'] :: reply to email address (can be different from sender's email address)
* $GLOBALS['ccList'] :: list of email address for cc purposes (optional) -- separate by commas
* $GLOBALS['bccList'] :: list of email address for bcc purposes (optional) -- separate by commas
* $GLOBALS['attachment'] :: file attachment (optional)
* $GLOBALS['plainTextVersion'] :: the plain text version of the message
* $GLOBALS['htmlVersion'] :: the html equivalent version of the message
* $GLOBALS['applicationType'] :: application mime type (optional)
* 'application/msword' for doc and docx files
* 'application/vnd.ms-excel' for csv, xls and xlsx files
* 'application/pdf' for pdf files
* this is all I have tested
* $GLOBALS['attachFileName'] :: name of file attachment (optional)
* $GLOBALS['subject'] :: message subject
*/
When I remove the $headers from the mail() arguments it works (of course not sending as HTML but as plain text).
Otherwise I get an error:
Warning: mail() [function.mail]: Bad parameters to mail() function, mail not sent. in /home/content/r/i/c/rickschram/html/www.4homesonly.com/pun.php on line 72
First...the $headers variable must be present. Don't remove it.
Secondly, you need to populate the $GLOBALS[] variables not like this:
$recipientsName = "Me";
$recipientsEmailAddress = "admin@livescore-bg.net";
$subject = "naslov";
but actually like this:
$GLOBALS['recipientsName'] = "Me";
$GLOBALS['recipientsEmailAddress'] = "admin@livescore-bg.net";
$GLOBALS['subject'] = "naslov";
Also, put something relevant inside these double quotes:
$GLOBALS['fromName'] = "a name";
$GLOBALS['fromEmailAddress'] = "an email address";
$GLOBALS['plainTextVersion'] = "the plain text copy of your message";
$GLOBALS['htmlVersion'] = "the html formatted copy of your message";
Can you tell me what to put here:
$GLOBALS['plainTextVersion'] = "the plain text copy of your message";
$GLOBALS['htmlVersion'] = "the html formatted copy of your message";
Sure, just copy and paste the 2 $GLOBAL variables below inserting them at the top of your PHP script. Bear in mind, that these 2 variables will contain the body of your message:
1 is a Plain Text Version (for those email clients that do not accept html email messages
and the other is the HTML Version of your message
$GLOBALS['plainTextVersion'] = 'You have got an Iquiry from one of our costumers
If you are having trouble reading this email please log in to your account...';
$GLOBALS['htmlVersion'] = '
<table width="650" cellspacing="0" cellpadding="0" border="0" align="center">
<tbody>
<tr>
<td bgcolor="#eee6d9" colspan="5">
<p style="color: rgb(153, 0, 0); font-family: Verdana,Geneva,sans-serif; font-size: 11px; padding-left: 15px;">You have got an Iquiry from one of our costumers<br />
If you are having trouble reading this email please log in to your account<a style="font-family: Verdana,Geneva,sans-serif; color: rgb(56, 74, 134); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">.</a></p>
</td>
<td><img height="56" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
</tr>
<tr>
<td bgcolor="#f7f2e6" colspan="3"><img height="55" width="442" border="0" alt="" id="n08mcburgundy_r2_c1" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/08-mc-burgundy_r2_c1.png" name="n08mcburgundy_r2_c1" /></td>
<td bgcolor="#f7f2e6" colspan="2"><img height="55" width="208" border="0" alt="Your Company Logo" id="n08mcburgundy_r2_c4" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/logo.png" name="n08mcburgundy_r2_c4" /></td>
<td><img height="55" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
</tr>
<tr>
<td height="31" width="647" bgcolor="#f7f2e6" colspan="5"><a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px; padding-left: 15px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Subscribe</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Back Issues</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Article Archive</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Resource Center</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Request Demo</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">example.com</a></td>
<td><img height="31" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
</tr>
<tr>
<td bgcolor="#f7f2e6"> </td>
<td valign="top" bgcolor="#f7f2e6">
<h1 style="font-family: Arial,Helvetica,sans-serif; color: rgb(146, 139, 119); font-size: 18px;">IN THIS ISSUE:</h1>
<h2> </h2>
<font color="#808080"><span style="font-weight: bold;">
<h2>Hello {{firstname}} {{lastname}},</h2>
<h2>You have an inquiry from {{country}} on your property.</h2>
<h2>The following is added.</h2>
<h2>Arrival date {{arrival_date}}</h2>
<h2>Departure date {{departure_date}}</h2>
<h2>Total party size {{with_children}}</h2>
<h2>with {{only_children}} Children</h2>
</span><br />
</font>
<p><a style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(153, 0, 0); font-weight: bold;" href="http://4homesonly.com" target="_blank">Please check the availability of your property here:</a><br />
</p>
<p style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(153, 0, 0); font-weight: bold;">MESSAGE:<br />
<br />
{{message}}<a style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; text-align: right; color: rgb(153, 0, 0);" href="mailto:address@email.com"><br />
</a></p>
</td>
<td colspan="2"> </td>
<td height="380" width="28" bgcolor="#f7f2e6"><a href="/userfiles/image/Active holiday Boy with fish.jpg"><img height="342" width="232" src="/userfiles/image/Active holiday Boy with fish.jpg" alt="boy" /></a></td>
<td><img height="380" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
</tr>
<tr>
<td bgcolor="#f7f2e6" rowspan="2"> </td>
<td bgcolor="#f7f2e6" colspan="3">
<h1 style="font-family: Tahoma,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 14px; font-weight: bold;">Featured Products</h1>
<p style="color: rgb(146, 139, 119); font-size: 12px; font-family: arial,verdana,sans-serif;">Lorem ipsum dolor sit amet, consect etuer adip iscing elit. Phasellus dui non magna commodo nascetur ridiculus volutpat porttitor. <br />
Ullamcorper sed, lobortis pretium, mi. Lorem ipsum dolor sit amet, consect etuer adip iscing elit. Phasell.</p>
</td>
<td height="407" width="28" bgcolor="#f7f2e6" rowspan="2"> </td>
<td><img height="124" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
</tr>
<tr>
<td valign="top" bgcolor="#f7f2e6" colspan="3">
<h1 style="font-family: arial,verdana,sans-serif; color: rgb(153, 0, 0); font-size: 14px; font-weight: bold;">Email Admin Center</h1>
<p style="font-family: arial,verdana,sans-serif; color: rgb(146, 139, 119); font-size: 12px;">This newsletter is a service of Example.com. Should you no longer wish to receive these messages please go here to unsubscribe or send an email to: unsubscribe-929@example.com <br />
<br />
To ensure delivery of this newsletter to your inbox and to enable images to load in future mailings, please add admincenter@example.com to your e-mail address book or safe senders list. You are receiving this email at yourname@example.com.<br />
<a style="font-family: Tahoma,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 12px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#"><br />
Update Your Profile</a> | <a style="font-family: arial,verdana,sans-serif; color: rgb(153, 0, 0); font-size: 12px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Web Version</a> | <a style="font-family: arial,verdana,sans-serif; color: rgb(153, 0, 0); font-size: 12px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Subscribe to Name</a></p>
</td>
</tr>
</tbody>
</table>
';
W8... Sorry for that question, I got it.. I filled the text of the message there of course, but now I again get the same error:
Warning: mail() [function.mail]: Bad parameters to mail() function, mail not sent. in /home/content/r/i/c/rickschram/html/www.4homesonly.com/pun.php on line 211
PHP Code:
<?php
/*
* I pulled this out of a function and dumbed it down a bit (keeping it basic) -- just populate
* all the $GLOBALS and you'll be good to go. Here's the $GLOBALS list:
* $GLOBALS['recipientsName'] :: name of person to receive message (optional)
* $GLOBALS['recipientsEmailAddress'] :: email address of person to receive message
* $GLOBALS['fromName'] :: name of person sending message (optional)
* $GLOBALS['fromEmailAddress'] :: email address of person sending message
* $GLOBALS['replyToName'] :: reply to persons name (optional)
* $GLOBALS['replyToEmailAddress'] :: reply to email address (can be different from sender's email address)
* $GLOBALS['ccList'] :: list of email address for cc purposes (optional) -- separate by commas
* $GLOBALS['bccList'] :: list of email address for bcc purposes (optional) -- separate by commas
* $GLOBALS['attachment'] :: file attachment (optional)
* $GLOBALS['plainTextVersion'] :: the plain text version of the message
* $GLOBALS['htmlVersion'] :: the html equivalent version of the message
* $GLOBALS['applicationType'] :: application mime type (optional)
* 'application/msword' for doc and docx files
* 'application/vnd.ms-excel' for csv, xls and xlsx files
* 'application/pdf' for pdf files
* this is all I have tested
* $GLOBALS['attachFileName'] :: name of file attachment (optional)
* $GLOBALS['subject'] :: message subject
*/
Bookmarks