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!

Mail Function Help 2

Status
Not open for further replies.

deecee

Technical User
Aug 25, 2001
1,678
US
Here is my simple mail function that is located on page 2. Page 1 holds the form that passes the fields on to page 2. for some reason I am yet to get a damn email...

The site is currently under construction but when i test it it aint working. Same goes for all my other mail forms on other sites. They all follow similar logic

Code:
<? if (!isset($email)){
     header(&quot;Location: [URL unfurl="true"]http://www.cascadecasinosolutions.com/corporate/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;;
	
    mail(&quot;darryn@cascadecorp.com&quot;, &quot;Register for Case Histories on Cascadepromotions.com&quot;,
          $msg, &quot;From: $email&quot;);
		  }
    ?>

sometime you just gotta say &quot;WHAT THE @#*% !!&quot;
 
well the code is all above the <head> tag

secondly apache server running supposedly the most current php and mysql version (not betas).

sometime you just gotta say &quot;WHAT THE @#*% !!&quot;
 
OOOO got it. I know its Unix but as for the php.ini i will have to contact my server admin on that

sometime you just gotta say &quot;WHAT THE @#*% !!&quot;
 
i did and nothing was sent so i guess this is something i will have to take up with server admin right?

sometime you just gotta say &quot;WHAT THE @#*% !!&quot;
 
deecee,

Check out It offers all different kinds of mailing options which also include SMTP authenticated mail delivery.

If you web host doesn't run sendmail you can use this class. If they run sendmail, I'd also use it because it has much to offer.

Check in phpinfo() the settings for
sendmail_path, SMTP
 
great link

sometime you just gotta say &quot;WHAT THE HECK&quot;
 
OK real quick is this syntax correct and should it in theory work if all the settings on the server are correct?

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;;
	
    mail(&quot;darryn@cascadecorp.com&quot;, &quot;Register for Case Histories on Cascadepromotions.com&quot;,
          $msg, &quot;From: $email&quot;);
		  }
    ?>

sometime you just gotta say &quot;WHAT THE @#*% !!&quot;
 
It looks fine to me.
You might want to include a reply to address and an X-Mailer header.
Here's the example from the PHP documentation:
Code:
mail(&quot;nobody@example.com&quot;, &quot;the subject&quot;, $message,
     &quot;From: webmaster@{$_SERVER['SERVER_NAME']}\r\n&quot;
    .&quot;Reply-To: webmaster@{$_SERVER['SERVER_NAME']}\r\n&quot;
    .&quot;X-Mailer: PHP/&quot; . phpversion());
 
Yes the function works when i try and send it to say my personal hotmail account. None of my forms on any of my sites (2) will send to my company's email. So the form is working but it wont send to my companys email. Why? I was thinking firewall or antispam filters set to Nazi-High.

sometime you just gotta say &quot;WHAT THE @#*% !!&quot;
 
It could be the antispam filters. Trying DRJ478's suggestion of additional headers might convince some antispam filters to let the message through. Unfortunately, there are too many ways an antispam filter could be barfing on the messages to advise to much more about what headers to send.

I doubt it's your company's firewall rules, unless your company has specifically locked out your service provider's IP address block.

It could even be a DNS problem at your service provider, but this is very unlikely.


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

Part and Inventory Search

Sponsor

Back
Top