skip to Main Content

I have a basic form on my site with fields like name, email etc. It sends to my email address with theses details normally.

However! I have just got myself a dedicated server with plesk on it.
I have pointed my name servers to my new dedicated server, and have got the site on there live. I have also recreated the email addresses with mailboxes, which all work.

BUT my site now does not want to send emails.

I have tested it again with this basic code without any luck.

<?php 
$Name = "Da Duder"; //senders name 
$email = "[email protected]"; //senders e-mail adress 
$recipient = "[email protected]"; //recipient 
$mail_body = "The text for ddfthe mail..."; //mail body 
$subject = "Subjectdfdfd"; //subject 
$header = "From: ". $Name . " <" . $email . ">rn"; //optional headerfields 

mail($recipient, $subject, $mail_body, $header); //mail command :) 
?>

I have been reading around about modifying the php.ini file to allow anonymous sending or something which is beyond my knowledge of PHP.

Is there anything i can check?

2

Answers


  1. try finding out your email settings, perhaps you don’t have a correct servers settings. phpinfo() is a good way to start looking

    Login or Signup to reply.
  2. Have you set-up the dedicated server yourself?

    Do you have error_reporting(E_ALL ^ E_NOTICE) and ini_set('display_errors', 'On') for testing?

    Did you check your junk-mail folder?

    Are you sure PHP is not throwing an error? Try this to make sure:

    if(mail($recipient, $subject, $mail_body, $header)){
        echo "Mail has been sent without errors";
    } else {
        echo "Mail has *not* been sent";
    }
    

    Otherwise ask a system or network adminstrator 🙂

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search