Jump to content

Problem!! PHP Form Mailer sends only HTML CODE


Recommended Posts

I recently switched to a virtual server that I have to manage. Since then I have had a problem with this PHP form. On the old server it would send the email over no problem (example1) But once I switched to this new server I get the email in a HTML Hard code format (Example 2) I am new to this whole unmanaged server thing and the host tells me it my code. Here is the actual PHP Used I have attached it Formmailer.zip. Any Help would be great Since I cannot figure it out.  I am sure its some small detail.

 

 

Thank you in advance.

 

-------------------------------------------------------------

Example 1

IP Address                              :      92.64.64.665

  Name                             : Test name

  Daytime phone number       : 111-111-1111

  Email                               :   [email protected]

  Quantity                             : 100

  Size                               :   2"

  Embroidery                             : 50%

  Method of Artwork Submission      : No artwork is available, please contact me.

Comments                           :

------------------------

EXAMPLE 2

------------------------

 

Content-type: text/html; charset=iso-8859-1

From: [email protected]


<html>
						<body>

							<table width='100%' cellpadding='2' cellspacing='1' border='0'>

								<tr valign='top'>

									<td style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'> </td>

									<td style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>IP Address</td>

									<td align='center' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>:</td>

									<td style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px;'>201.202.136.58</td>

								</tr>

								<tr valign='top'>

									<td width='3%' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'> </td>

									<td width='20%' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>Name </td>

									<td width='3%' align='center' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>:</td>

									<td width='74%' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px;'>Test</td>

								</tr>

								<tr valign='top'>

									<td width='3%' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'> </td>

									<td width='20%' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>Daytime phone number</td>

									<td width='3%' align='center' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>:</td>

									<td width='74%' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px;'>111-111-1111</td>

								</tr>

								<tr valign='top'>

									<td style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'> </td>

									<td style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>Email </td>

									<td align='center' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>:</td>

									<td style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px;'>[email protected]</td>

								</tr>

								<tr valign='top'>

									<td width='3%' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'> </td>

									<td width='20%' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>Quantity</td>

									<td width='3%' align='center' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>:</td>

									<td width='74%' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px;'>100</td>

								</tr>

								<tr valign='top'>



									<td style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'> </td>

									<td style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>Size </td>

									<td align='center' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>:</td>

									<td style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px;'>2"</td>

								</tr>

								<tr valign='top'>

									<td width='3%' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'> </td>

									<td width='20%' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>Embroidery </td>

									<td width='3%' align='center' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>:</td>

									<td width='74%' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px;'>50%</td>

								</tr><tr valign='top'>

									<td width='3%' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'> </td>

									<td width='20%' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>Method of Artwork Submission</td>

									<td width='3%' align='center' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>:</td>

									<td width='74%' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px;'>No artwork is available, please contact me.</td>

								</tr><tr valign='top'>

									<td style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'> </td>

									<td style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>Comments</td>

									<td align='center' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold'>:</td>

									<td style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px;'>no comments</td>

								</tr>

							</table>

						</body>

						</html>
''''End Of HTML

 

 

[attachment deleted by admin]

SO I talked with my server tech support and they are telling me it is a problem in the code and I needed to use the sendmail path /usr/sbin/sendmail. and  "You need to us SMTP port 25 and server name mail.domainname.com" I think I have this right but The Email still comes through as hard html code and the sender address says [email protected] instead of Birthday Reminder <[email protected]>

 

Can Someone please look this over and lend a hand.

 

 

Test Code for sending email

 

<?php

// multiple recipients

$to  = '[email protected]' . ', '; // note the comma

$to .= '[email protected]';

 

// subject

$subject = 'Birthday Reminders for August';

 

// message

$message = '

<html>

<head>

<title>Birthday Reminders for August</title>

</head>

<body>

<p>Here are the birthdays upcoming in August!</p>

<table>

<tr><th>Person</th><th>Day</th><th>Month</th><th>Year</th></tr>

<tr><td>Joe</td><td>3rd</td><td>August</td><td>1970</td></tr>

<tr><td>Sally</td><td>17th</td><td>August</td><td>1973</td></tr>

</table>

</body>

</html>

';

 

 

// To send HTML mail, the Content-type header must be set

$headers  = 'MIME-Version: 1.0' . "/usr/sbin/sendmail";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "/usr/sbin/sendmail";

 

// Additional headers

$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "/usr/sbin/sendmail";

$headers .= 'From: Birthday Reminder <[email protected]>' . "/usr/sbin/sendmail";

$headers .= 'Cc: [email protected]' . "/usr/sbin/sendmail";

$headers .= 'Bcc: [email protected]' . "/usr/sbin/sendmail";

 

// Mail it

mail($to, $subject, $message, $headers);

?>

I think it's in the header. I don't know for sure what it is, but I'd strip the header down to bare minimum and start to build back up. I have a script at work that sends an HTML email, its header only contains the Content Type ; charset, and the From: [email protected].

I'm not at work now, so I don't have it in front of me, but I think mine looks like this:

$header = 'Content-type: text/html; charset=iso-8859-1\nFrom: [email protected]';

The biggest difference is the new line seperator. ..and isn't the sendmail path only supposed to be in the ini, not in the email headers?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.