Jump to content

[SOLVED] mail() doesn't work


dennismonsewicz

Recommended Posts

I am trying to use the mail() function on my server and it doesn't work. I tried it on another server and it works fine, but not on the current server.

 

Code:

 

<?php

$Name = "Da Duder"; //senders name
$email = "[email protected]"; //senders e-mail adress
$recipient = "[email protected]"; //recipient
$mail_body = "The text for the mail..."; //mail body
$subject = "testing"; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";

if(mail($recipient, $subject, $mail_body, $header)) {
echo '<p>Mail sent successfully...</p>';
} else {
echo '<p>Mail delivery impossible!</p>';
} //mail command 
?>

 

I receive the "Mail delivery impossible" when I try running the page on one server and the "Mail sent successfully..." on another server :(

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/125486-solved-mail-doesnt-work/
Share on other sites

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.