Php Mail不发送电子邮件id包含的邮件user@domain.in.


Php Mail is not sending the mail through which email id contain user@domain.in

$to="user@domain.in";
$subject="Entry Level Freshers Candidates";
// Get the sender's name and email address plug them a variable to be used later
$from = stripslashes($_POST['nfirst'])."<".stripslashes($_POST['email']).">";
$message = '<html><body>'; .........
mail($to, $subject, $message, $headers);

当电子邮件id为user@domain.com,但当电子邮件id为user@domain.in.

请给我解决方案,

您可以在他们的网站上获得swiftmailer包->http://swiftmailer.org/

require_once 'swiftmailer/lib/swift_required.php';
function new_mail($subject, $content, $recipients, $from)
{
    // Create the message
    $message = Swift_Message::newInstance();
    // Give the message a subject
    $message->setSubject($subject);
    // Set the From address with an associative array
    $message->setFrom($from);
    // Set the To addresses with an associative array
    $message->setTo($recipients);
    // Give it a body
    $message->setBody($content);
    $transport = Swift_MailTransport::newInstance();
    $mailer = Swift_Mailer::newInstance($transport);
    $result = $mailer->send($message);
}
$message            = "Anything you want here.";
$recipients         = array('emailaddress@goeshere.com' => 'Your name of choice');
$subject            = "Subject goes here";
$from               = array('emailaddress@goeshere.com' => 'Name of choice.');
new_mail($subject, $message, $recipients, $from);

我从另一个答案中修改了这段代码。让我知道这个是否适合你。