cesargarcialeon Posted July 23, 2010 Share Posted July 23, 2010 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 :-) Link to comment https://forums.phpfreaks.com/topic/208650-help-with-mail/ Share on other sites More sharing options...
inversesoft123 Posted July 23, 2010 Share Posted July 23, 2010 Many times Free hosting providers block outgoing emails. post your code here if you are not on free hosting services. Link to comment https://forums.phpfreaks.com/topic/208650-help-with-mail/#findComment-1090038 Share on other sites More sharing options...
cesargarcialeon Posted July 23, 2010 Author Share Posted July 23, 2010 Below you can see my php script. The only thing I have changed is the email addresses ;-) <?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'> </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 <[email protected]>"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $headers .= 'To: Main Recipient <[email protected]>' . "\r\n"; $headers .= 'From: Main Recipient <[email protected]>' . "\r\n"; $headers .= 'Cc: Secondary Recipient <[email protected]>' . "\r\n"; $headers .= 'Bcc: Secret Recipient <[email protected]>' . "\r\n"; mail($to, $subject, $message, $headers); ?> PS: The website is not on a free hosting provider. Link to comment https://forums.phpfreaks.com/topic/208650-help-with-mail/#findComment-1090053 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.