I have a domain www.ipsmeerut.com
, i m using the script below to send mail. It is returning true but mail is not sending.
Here's my script:
<?php
$to = 'brajnacs@gmail.com';
$subject = 'Test';
$headers = "From: Test<no-reply@ipsmeerut.com>
";
$headers .= "MIME-Version: 1.0
";
$headers .= "Content-Type: text/html; charset=ISO-8859-1
";
$message = "<html><body>";
$message .= "<h1>Hello, World!</h1>";
$message .= "</body></html>";
$res=false;
$res=mail($to, $subject, $message, $headers);
var_dump($res);
echo "Mail sent to ".$to;
?>
This script is working fine on my other domains. var_dump
is showing true
. My mail server is aspmx.l.google.com
and I have also added MX Entry
for it.
Use phpmailer, Try this
require_once('../class.phpmailer.php');
$mail = new PHPMailer(); // defaults to using php "mail()"
$body = 'you content goes here';
$body = eregi_replace("[\]",'',$body);
$mail->AddReplyTo("name@yourdomain.com","First Last");
$mail->SetFrom('name@yourdomain.com', 'First Last');
$mail->AddReplyTo("name@yourdomain.com","First Last");
$address = "whoto@otherdomain.com";
$mail->AddAddress($address, "John Doe");
$mail->Subject = "PHPMailer Test Subject via mail(), basic";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$mail->AddAttachment("images/phpmailer.gif"); // attachment
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
why not just using your default MX and try testing again? dose Google allows to send anonymous email with authentication?