Jump to content

simple mail script, won't work with "samedomain.com" addresses


Recommended Posts

Hi everyone. For a client's site, I use a simple php mail script for a contact form.To keep thing simple, the domain is abc123.com and I'm hosting this site (I have reseller hosting)

 

The problem I'm having, is that for the $mailto , if I have it set as blah@abc123.com , then it won't work.

 

but if I set the $mailto as anythingelse@anyotherdomain.com then it works perfect.

 

I have a feeling it's somewhat of a backend issue ? or maybe I need to add something to the php script. Anything will help, thanks for reading.

 

the code :

 


<?php
$mailto = 'blah@abc123.com';
$subject = " abc123.com - Main Contact Feedback" ;
$submitsubject = "Thank you for contacting us" ;

$formurl = "contact.php" ;
$thankyouurl = "../html/thankyou.html" ;

$uself = 0;

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$firstname = $_POST['firstname'] ;
$lastname = $_POST['lastname'];
$email = $_POST['email'] ;
$procedure = $_POST['procedure'];
$find_us = $_POST ['find_us'];
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );

$messageproper =

"This message was sent from:\n\n" .
"Name: $firstname $lastname\n" .
"Email: $email\n" .

"----------------------------------------------------------\n\n" .
"Service: $procedure \n\n".
"Comments: \n\n $comments\n" .

"----------------------------------------------------------\n\n" .

"This message was sent from this URL : $http_referrer \n\n Found via: $find_us \n" ;


$response = 

"Dear $firstname,\n\n" .
"Thank you contacting us, your message has just been sent to our inbox, and we will be contacting you shortly.\n\n" .
"Thanks and have a great day.\n\n" .
"ABC123 Company.\n\n" .
"http://www.abc123.com \n" ;


mail($mailto, $subject, $messageproper,
"From: \"$firstname $lastname\" <$email>" . $headersep . "Reply-To: \"$firstname $lastname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07");

mail($email, $submitsubject, $response,
"From: \"ABC123 Company\" <info@abc123.com>" . $headersep );

header( "Location: $thankyouurl" );
exit ;

?>

I have a feeling it's somewhat of a backend issue ?

 

most likely. my experience has been that it is almost never a problem with the mail being sent, but usually a problem with the mail being received. However, you might want to try sending without any additional headers and/or changing the values of the headers to see if you have better luck. Of course, don't forget to check your spam.

I posted on sitepoint.com as well, and somebody responded with this :

 

There is no MX record for abc123.com, it point's to daemonmail.net, and daemonmail.net says abc123.com does not have permission to send or recieve mail through (mx1.daemonmail.net, mx2.daemonmail.net). Contact your host and have them setup your mail exchange or add relay permission to accept and send mail for abc123.com through their mail exchange.

 

now I'm not sure if he was using abc123.com as an example, as I was, or if he was serious, but basically, does this mean i need to edit a dns zone, cname, mx record ? if so, I can.

 

Thank you for your post bluesky

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.