zero-perfoliate
zero-perfoliate

Author Topic: Help with MAIL  (Read 244 times)

Offline cesargarcialeon

  • New PHP Members
  • Posts: 2
  • Karma: +0/-0
Help with MAIL
« on: July 24, 2010, 02:03:13 AM »

Hi all.

I'm new to the forum and novice to PHP. I'm facing a strange problem... at least strange to me :-)
I'm trying to make a contact form which is working perfectly but the message won't be delivered if the recipient is an email alias and not a real address.

Do you think the problem is about my script or the server configuration?

Thanx in advance :-)


<?php
	
$ip $_POST['ip'];
	
$httpref $_POST['httpref'];
	
$httpagent $_POST['httpagent'];
	

	
$firstname $_POST['firstname'];
	
$lastname $_POST['lastname'];
	
$email $_POST['email'];
	
$phone $_POST['phone'];
	
$thesubject $_POST['thesubject'];
	
$themessage $_POST['themessage'];
	

	
$todayis date("l, F j, Y, G:i a") ;
	
$subject "Contact Form";
	

	
$message "<html><body><table cellpadding='5' cellspacing='0' border='0'>";
	
$message .= "<tr><td style='font: bold 13px Arial'>Firstname</td><td style='font: 13px Arial'>$firstname</td></tr>";
	
$message .= "<tr><td style='font: bold 13px Arial'>Lastname</td><td style='font: 13px Arial'>$lastname</td></tr>";
	
$message .= "<tr><td style='font: bold 13px Arial'>Email</td><td style='font: 13px Arial'>$email</td></tr>";
	
$message .= "<tr><td style='font: bold 13px Arial'>Phone number</td><td style='font: 13px Arial'>$phone</td></tr>";
	
$message .= "<tr><td style='font: bold 13px Arial'>Subject</td><td style='font: 13px Arial'>$thesubject</td></tr>";
	
$message .= "<tr><td style='font: bold 13px Arial'>Message</td><td style='font: 13px Arial'>$themessage</td></tr>";
	
$message .= "<tr><td colspan='2'>&nbsp;</td></tr>";
	
$message .= "<tr><td style='font: bold 11px Arial; color: #555'>Timestamp</td><td style='font: 11px Arial; color: #555'>$todayis</td></tr>";
	
$message .= "<tr><td style='font: bold 11px Arial; color: #555'>Senders IP address</td><td style='font: 11px Arial; color: #555'>$ip</td></tr>";
	
$message .= "</table></body></html>";
	

	
$to "Main Recipient <main@recipient.com>";
	

	
$headers  'MIME-Version: 1.0' "\r\n";
	
$headers .= 'Content-type: text/html; charset=utf-8' "\r\n";
	
$headers .= 'To: Main Recipient <main@recipient.com>' "\r\n";
	
$headers .= 'From: Main Recipient <main@recipient.com>' "\r\n";
	
$headers .= 'Cc: Secondary Recipient <secondary@recipient.com>' "\r\n";
	
$headers .= 'Bcc: Secret Recipient <secret@recipient.com>' "\r\n";
	

	
mail($to$subject$message$headers);
?>


Offline Andrei

  • Administrator
  • PHP Workers
  • *****
  • Posts: 11
  • Karma: +0/-0
Re: Help with MAIL
« Reply #1 on: July 25, 2010, 02:34:05 AM »
 If it's working with a normal email address and you enter the alias address right then it's a server problem. Enter a valid email address on the From field so you can get an error message back.

Offline cesargarcialeon

  • New PHP Members
  • Posts: 2
  • Karma: +0/-0
Re: Help with MAIL
« Reply #2 on: July 25, 2010, 11:46:18 AM »
I put a real address on the from field but no error and no delivery either  :(