Jump to content

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                               :   Test@test.com

  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: Test@Test.com


<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;'>Test@Test.com</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 anonymous@domainname.com instead of Birthday Reminder <birthday@example.com>

 

Can Someone please look this over and lend a hand.

 

 

Test Code for sending email

 

<?php

// multiple recipients

$to  = 'promodaddy@gmail.com' . ', '; // note the comma

$to .= 'ianmcroberts@gmail.com';

 

// 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 <mary@example.com>, Kelly <kelly@example.com>' . "/usr/sbin/sendmail";

$headers .= 'From: Birthday Reminder <birthday@example.com>' . "/usr/sbin/sendmail";

$headers .= 'Cc: birthdayarchive@example.com' . "/usr/sbin/sendmail";

$headers .= 'Bcc: birthdaycheck@example.com' . "/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@host.domain.

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@host.domain';

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.