Page 1 of 1

Processing HTML-based e-mail via IIS

Posted: Wed Jun 21, 2006 1:05 pm
by posurreal
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I am being volleyed from my Web host to my PHP programmer regarding the following issue and need your advice on how to proceed.

1) I have a shopping cart and contact form on my site that sends an HTML-based e-mail. 
2) The e-mail sends successfully to a test AOL account as well as another domain name; however, the domain name that is actually hosted sends but with [u]blank[/u] contents.
3) We have three e-mail accounts that are receiving the contents as blank, on three computers. So, we're ruling out e-mail settings via Outlook.
4) Since the e-mail sends correctly via other addresses, the programmer says that it's a server-side issue.
5) Since I can send an HTML-based message (via a 3rd party software program) to the domain name (e-mail) accounts, independent of the site, the Web host says that it's the code inside of the cart and contact page.

Notes:
1) We have php3, php and phps extensions on.
2) The programmer is using .css and I noticed that my test HTML e-mail did not pull the .css but sent it successfully with default font.
3) Contact Us form is located at http://www.maxuspt.com/contact_us.shtml

Points to system_site_contact.php
Code for this page is below.

Code: Select all

<?

	// explode array in contact product
	for($i=0; $i<= sizeof($contact_products)-1; $i++) {
		$contact_products2 .= $contact_products[$i] . "<br>";
	}


	include("setting.php");
	$db_connect 	= mysql_connect($db_host, $db_username, $db_password);
	mysql_select_db($db_name, $db_connect) || die(mysql_error());
	
	$sql_query		= "SELECT * FROM setup_email WHERE email_id = '3'";
	$result			= mysql_query($sql_query) or die(mysql_error());
	$row			= mysql_fetch_array($result);
	$email_contact	= $row[email_content];
	mysql_close($db_connect);



	// replace strings ...
	$email_contact		= str_replace("[contact_products]", $contact_products2, $email_contact);
	while (list ($key, $val) = each ($HTTP_POST_VARS)) {
		$email_contact	= str_replace("[$key]", $val, $email_contact);
	}


	// send email ...
	ini_set("SMTP","localhost");
	ini_set("sendmail_from", "sales@maxuspt.com");
	
	$message 		= "";
	srand((double)microtime()*1000000);
	
	
	$semi_rand		= md5(time());
	$mime_boundary	= "==Multipart_Boundary_x{$semi_rand}x";
	$headers		= "From: Maxus Poker Table<sales@maxuspt.com>\n" .
					  "MIME-Version: 1.0\n" .
					  "Content-Type: multipart/mixed;\n" .
					  " boundary=\"{$mime_boundary}\"";
	$message		= "This is a multi-part message in MIME format.\n\n" .
					  "--{$mime_boundary}\n" .
					  "Content-Type: text/html; charset=\"iso-8859-1\"\n" .
					  "Content-Transfer-Encoding: 7bit \n\n". $email_contact . " \n\n".
					  "--{$mime_boundary}\n";
					  
	mail($contact_recipient, $contact_subject, $message, $headers);
	mail("mary@abouttrimedia.com", $contact_subject, $message, $headers);
	mail("webmaster@maxuspt.com", $contact_subject, $message, $headers);
	header("location:$contact_redirect");


?>

Fingers are pointing and I just need it to work. Am I missing something?

Thanks, Mary


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Thanks feyd

Posted: Thu Jun 22, 2006 1:26 pm
by posurreal
Yes, I will learn that. Thanks for taking care of it this time.

Posted: Thu Jun 22, 2006 2:08 pm
by RobertGonzalez
So everything that is supposed to be sent is being sent and received by AOL based web mail, but not Outlook based email? I am trying to wrap my head around what you are asking. It sounds like the code will send an HTML mail to at least one of the email address in the mail() function, possibly a second and the third gets the mail, but without content. Is that correct?

Is it set up to send a copy to the sender of the mail? I am also looking for where the var $contact_recipient is being valued. Of the two email addresses that are hard coded in to the script, are either of them having problems?

Thanks for taking time to review this issue

Posted: Thu Jun 22, 2006 2:34 pm
by posurreal
Thanks for taking the time to investigate this problem for me!

The code resides at maxuspt.com, so it is sending from maxuspt.com.

Re: It sounds like the code will send an HTML mail to at least one of the email address in the mail() function, possibly a second and the third gets the mail, but without content. Is that correct? Yes, that is correct.

$contact_recipient is located at the bottom of system_site_contact.php (code included in forum) and is currently set to mary@abouttrimedia.com and webmaster@maxuspt.com. We have also tested an AOL account . The HTML-based e-mail sends successfully from the maxuspt.com server to both mary@abouttrimedia.com and the AOL account (currently not in the code). However, the e-mail is blank for webmaster@maxuspt.com. It also shows up blank for sales@maxuspt.com and support@maxuspt.com. Everyone testing is receiving the e-mail via Outlook.

I have also created a separate HTML-based e-mail blast and have sent it via my 3rd party software. This e-mail did arrive successfully to webmaster@maxuspt.com, which makes me think that we are not facing Outlook settings for antivirus settings.

I wonder if the mime content code needs to have additional code since we're running php on a Windows platform (long story why that happened). I've been investigating that possibility at http://us3.php.net/manual/en/function.m ... t-type.php but have no idea if I'm wasting my time.

Thanks, Mary

Posted: Thu Jun 22, 2006 3:47 pm
by RobertGonzalez
You, the headers you forwarded to me in the email are not the same as the ones in the code...

Your Code:

Code: Select all

$headers = "
     From: Maxus Poker Table<sales@maxuspt.com>\n" .
    "MIME-Version: 1.0\n" .
    "Content-Type: multipart/mixed;\n" .
    " boundary=\"{$mime_boundary}\"";

$message = "
     This is a multi-part message in MIME format.\n\n" .
    "--{$mime_boundary}\n" .
    "Content-Type: text/html; charset=\"iso-8859-1\"\n" .
    "Content-Transfer-Encoding: 7bit \n\n". $email_contact . " \n\n".
    "--{$mime_boundary}\n";
What was sent:

Code: Select all

MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="==Multipart_Boundary_xb6d2700211d60a3ec9317ab754da9b26x"
Return-Path: sales@maxuspt.com
Message-ID: <WIN16nHM3SOlbpH71yE00000002@win16.securedc.com>
X-OriginalArrivalTime: 22 Jun 2006 19:09:35.0812 (UTC) 
FILETIME=[66BFE840:01C6962F]

This is a multi-part message in MIME format.
--==Multipart_Boundary_xb6d2700211d60a3ec9317ab754da9b26x
Content-Type: 
text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
I'm wondering what this is all about?

Posted: Thu Jun 22, 2006 3:48 pm
by RobertGonzalez
For your developer, there is a decent rundown of MIME related stuff at the Zend Knowledge Base.

Header Difference

Posted: Thu Jun 22, 2006 4:13 pm
by posurreal
The headers may be different because the e-mail went to the client, forwarded to me, then to you. I didn't realize until after you tested that my programmer had changed the e-mail from webmaster@maxuspt.com to sales@maxuspt.com.

So, this afternoon, I changed it back to webmaster@maxuspt.com so that I can receive the tests directly.

Thanks for the Zend link.
Warmest Regards,
Mary :D