Jump to content

Help with sending mails


JJohnsenDK

Recommended Posts

Hey

 

Im having some problems with sending mails via my mailserver, or atleast i think it is my mail server that is the problem.

 

I made this script:

 

<?php
$to = "[email protected]";
$subject = "Test af mail sendning";
$message = "Jaaah, dette er så en test.";
$headers = "From: [email protected]";

echo "<h2>This sends mail to ".$to."</h2>";

if(mail($to, $subject, $message, $headers)){
    echo "Send!";
}else{
    echo "Could'nt send the mail ";
}

 

It returns Send! so the mail() function does its work, right? But i dont get any mail and i have also chekced my junk mail. I tried 3 different mail accounts, but notthing.

 

What is wrong? Is it the mailserver which doesnt send the mail or?

Link to comment
https://forums.phpfreaks.com/topic/105704-help-with-sending-mails/
Share on other sites

try this if it dosent work then post your php.ini settings for mail.........

<?php
$to = '[email protected]';
$subject = 'Wakeup bob!';
$message = '<b>yo</b>, whassup?';
$headers = "From: [email protected]\r\n" .
        'X-Mailer: PHP/' . phpversion() . "\r\n" .
        "MIME-Version: 1.0\r\n" .
        "Content-Type: text/html; charset=utf-8\r\n" .
        "Content-Transfer-Encoding: 8bit\r\n\r\n";

// Send
mail($to, $subject, $message, $headers);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.