i want use "Post by Email" feature,but have some problems,my blog can't reveive email!
at first i use phpmailer,and here is the code:
require_once('./class-phpmailer.php');
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
$mail->IsSMTP(); // telling the class to use SMTP
try {
$mail->Host = "pop.gmail.com"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "[email redacted]"; // GMAIL username
$mail->Password = "mypwd"; // GMAIL password
// $mail->AddAddress("[email redacted]","justanimal");
//$mail->AddBCC("[email redacted]","justanimal");
$mail->AddAddress("[email redacted]","xiehua");
//$mail->AddAddress("[email redacted]","xiehua");
$mail->SetFrom('[email redacted]',"xiehua");
$mail->AddReplyTo('[email redacted]', 'xiehua');
$mail->Subject = 'hello';
$mail->MsgHTML("[title hello] [tags hello,animals] helloworld");
$mail->Send();
echo "Message Sent OK</p>\n";
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
i try
1. send to my gmail and wordpress blog , blog can't receive email
2. send to my gmail and cc to wordpress blog, blog can't receive email
3. send to my gmail and bcc to wordpress blog, blog can't receive email.
4. send to wordpress blog, blog can't receive email.
and then i try mail() function. and i change the header,also can't receive email
code is here
$headers .= "Date: ". date("D, j M Y H:i:s")."\n"; //date;
$headers .= "From: <[email redacted]>\n"; // your mail
$headers .= "To: \"blog\" <[email redacted]>\n"; // mail to post
$headers .= "Content-Type: text/plain; charset=UTF8; format=flowed \n" ;
$headers .= "Content-Transfer-Encoding: 8bit\n";
$param = "-f <[email redacted]>"; // your mail
mail ("[email redacted]", "this is a test" , "can you help me?",$headers,$param);
this also can't receive email!
but if i use gmail or outlook ,the wordpress blog can receive email!
can you help me?
Blog url: http://justanimal.wordpress.com/