Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2009
    Location
    Hamphire, UK
    Posts
    47
    Thanks
    7
    Thanked 1 Time in 1 Post

    PHP contact form problem

    I am trying to make a PHP contact form on a website, that takes info entered into a contact form and sends it to a client's email.

    The problem I am having is that the domain name and domain emails are hosted on a seperate server to the site files and CMS databases.
    When the form tries to send to the email address, the enquiry fails (due to the fact that the email is in fact on a seperate server to the contact form, I believe).

    Is there anyway to avoid this problem?

    The code I am using to process the contact form is as follows:

    Code:
    $send = "email@domain.com";
    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type:text/html; charset=utf-8" . "\r\n";
    $headers .= "From: $name <'$email'>" . "\r\n";
    $subject = "Booking enquiry from domain.com - $name";
    mail($send,$subject,$body,$headers);
    
    header("Location: booking_thankyou.php");
    Obviously with 'email@domain.com" being the domain email address.

    The error code I get is:

    Warning: mail() [function.mail]: SMTP server response: 550 Requested action not taken: mailbox unavailable or not local in...

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    you need to change the local host name on the box to something other then the main domain name for the site.

    so your mail server is likely something like: mail.domain.com
    as such your web server should be: web.domain.com

    that should solve your problem.

  • #3
    New Coder
    Join Date
    Jun 2009
    Location
    Hamphire, UK
    Posts
    47
    Thanks
    7
    Thanked 1 Time in 1 Post
    Quote Originally Posted by angst View Post
    you need to change the local host name on the box to something other then the main domain name for the site.
    Hi, thanks for the reply, but I'm not sure I understand what you mean. Where do you mean by 'on the box'?

  • #4
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    box as in server, if you or your company runs this server then you need to change the host name.

  • #5
    New Coder
    Join Date
    Jun 2009
    Location
    Hamphire, UK
    Posts
    47
    Thanks
    7
    Thanked 1 Time in 1 Post
    Quote Originally Posted by angst View Post
    box as in server, if you or your company runs this server then you need to change the host name.
    AH! Sorry, I understand now. Thanks.


  •  

    Posting Permissions

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