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 = "dennismonsewicz@gmail.com"; //senders e-mail adress
$recipient = "dennismonsewicz@gmail.com"; //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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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