SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist
    Join Date
    Mar 2006
    Posts
    407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    form to mail recipients

    Hi Folks, i have a form that sends contact information to a db, then i have one confirmation email sent and one email sent to the admin.

    The db insert and the confirmation email work fine, however the email to admin doesnt ....well, arrive. Ive used

    Code:
    		$query = "INSERT INTO ccctact (first, sur, email, tel, message) VALUES ('$firstname', '$surname', '$email', '$tel', '$message')";
    		
    $result = mysql_query($query) or die(mysql_error());
    if (mysql_affected_rows() == 1) {
    						// Send the E-Mail
    						
    						
    $body = "auto reply message";
    				
    $body2 = "Name:$_POST[firstname] \n\n
    Surname:$_POST[surname] \n\n
    Email:$_POST[email] \n\n
    Tel:$_POST[tel] \n\n
    Message: $_POST[message] \n\n
    ";
    			
    mail($_POST['email'], 'NO_REPLY: Contact via website', $body, 'From: NO_REPLY@domain.com');
    			mail('admin@domain.com', 'Contact Via website', $body2, 'From: NO_REPLY@@domain.com');
    The strange thing is, if i replace the admin email address to my domain (that is differant to the 'domain.com', it works....

    Is there somthing wrong with my script, or do you think its an issue with the host?

    ........thanks in advance

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2005
    Posts
    1,191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It works with an email address not related to your domain? Then nothing wrong with the code, is your host also the mail server? If not, that could be the issue, php might be sending to the local server and ignoring the mx records.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •