Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

email script not showing 1

Status
Not open for further replies.

deecee

Technical User
Aug 25, 2001
1,678
US
ok here it is...this script will not send to my corporate email still but i can get it to my hotmail account (thats another issue that i am trying to workout)..however i was perusing the web and read up on headers. so i added in a bunch of them hoping it would help get the email past my companys firewall. alas nothing, but now when i send it to my hotmail account the message doestn show up. the email is there but it is blank. if i remove the headers then the message shows up. i dont really understand most of the headers and what they do so really if anyone can explain that would be helpful. also what is "boundary=" and what is $seperator? are these reserved variables in php or something?

Code:
<? if (!isset($email)){
     header(&quot;Location: [URL unfurl="true"]http://www.cascadecorp.com/register.php&quot;);[/URL] 
	 }
	 
	 else {
	 
    $msg = &quot;MR/MRS:\t$mr\n&quot;;
	$msg .= &quot;First Name:\t$first\n&quot;;
    $msg .= &quot;Last Name:\t$last\n&quot;;
    $msg .= &quot;Middle Initial:\t$middle\n&quot;;
	$msg .= &quot;JR/PHD/ETC:\t$jr\n&quot;;
	$msg .= &quot;Email:\t$email\n&quot;;
    $msg .= &quot;Phone Number:\t$phone\n&quot;;
    $msg .= &quot;Fax:\t$fax\n&quot;;
	$msg .= &quot;Title:\t$title\n&quot;;
    $msg .= &quot;Company:\t$company\n&quot;;
    $msg .= &quot;Street1:\t$street1\n&quot;;
    $msg .= &quot;Street2:\t$street2\n&quot;;
    $msg .= &quot;City:\t$city\n&quot;;
    $msg .= &quot;State:\t$state\n&quot;;
    $msg .= &quot;Country:\t$country\n&quot;;
    $msg .= &quot;Zip:\t$zip\n&quot;;
	$msg .= &quot;Job:\t$job\n&quot;;
	$msg .= &quot;Function:\t$function\n&quot;;
	$msg .= &quot;Do They Want More Info In The Future:\t$info\n&quot;;
	$header = &quot;From: $first<$email>\n&quot;; 
	$header .= &quot;MIME-Version: 1.0\r\n&quot;; 
	$header .= &quot;Reply-To: <$email>\n&quot;; 
	$header .= &quot;Content-Type: multipart/alternative; charset=\&quot;iso-8859-1\&quot;; boundary=\&quot;$separator\&quot;;\r\n\r\n&quot;; 
	$header .= &quot;Content-Transfer-Encoding: 8bit\r\n&quot;; 
	$header .= &quot;X-Priority: 3\r\n&quot;; 
	$header .= &quot;X-Mailer: phpmailer [version 1.40]\r\n&quot;; 
	$header .= &quot;Return-Path: $email\r\n&quot;; 

	
    mail(&quot;darrync@hotmail.com&quot;, &quot;Register for Case Histories on Cascadepromotions.com&quot;,
          $msg, $header);
		  }
    ?>

<signature>
sometime you just gotta say &quot;WHAT THE @#*% !!&quot;
</signature>
 
To begin with, your use of returns wanders quite a bit. I recommend that you use &quot;\r\n&quot; everywhere.

Also, you have one header which terminates in &quot;\r\n\r\n&quot;. This will insert a blank line, which separates headers from message body. That could be confusing your mail client.

The &quot;boundary&quot; part of the header is used in multipart MIME email. If, for example, you have an email with a text body and an attachment, then the text message and the attachment will be separated in the message body stream. The actual separator used is arbitrary, but it's a good idea to pick one that is not going to appear in a MIME block, keeping in mind that 8-bit data is uuencoded into 7-bit data before it is sent.

One thing that might make it easier to figure out headers is to use the PHPMailer email sending class, available here: . It's very good, and can produce complex emails you can examine to see what's going on.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top