ဒီနေ့ Client Server မှာ တင်တော့ mail() function က php မှာ သုံးမရဘူးဖြစ်နေတယ်။ တကယ်တန်းတော့ symfony မှာ ဘာ plugin လဲမသိပါဘူး။ မေ့တောင် မေ့သွားပြီ။ အဲဒါနဲ့တွဲသုံးထားတာ။ mail() function လိုတယ်ဆိုတာနဲ့ mail function enable လုပ်ဖို့ စရပါတော့တယ်။ Ubuntu Server ဆိုတော့ ရှာရတာ အရမ်းလွယ်တယ်။ ဘာမှ မခက်ဘူး။ exim4 ကို သွင်း။ ပြီးရင် config လုပ်။ အဲဒါကလည်း
https://help.ubuntu.com/community/Exim4
အဲဒီမှာ ဖတ်လိုက်လို့ရတယ်။
sudo apt-get install exim4
လို့ သွင်းပြီး
sudo dpkg-reconfigure exim4-config
ဆိုပြီး config လုပ်လိုက်ရုံပဲ။ Config ကလည်း English လိုရေးထားတာပဲလေ။ Wizard နဲ့step by step လုပ်လိုက်တော့ အဆင်ပြေသွားတယ်။ ပြီးတော့ php.ini မှာ
sendmail_path = /usr/sbin/sendmail
ဆိုပြီး သွားထည့်ပေးလိုက်တယ်။ အစက comment ပိတ်ထားတာ။ comment လေး သွားဖွင့် ။ sendmail path လေးထည့်ပေးလိုက်ရုံပဲ။ နောက်ဆုံး apache restart ချ။ ပြန်စမ်းတော့ ရသွားပါလေရော။ သိပ်လည်း မကြာလိုက်ပါဘူး။ နာရီဝက် လောက်ပဲ ကြာတယ်ထင်တယ်။ Ubuntu Server ကို အဲလို လိုချင်တာလေး မြန်မြန် ရှာရတာ လေးကို သဘောကျတာ။
php ရဲ့ mail() function က Google Mail တွေကို Send တဲ့အခါ ပြသနာဖြစ်တော့တာပဲဗျာ
gmail က Spam မေးလ်လို့သတ်မှတ်တာရယ် . Subject မပေါ်တာရယ်ပါ
အဲ့ပြသနာအတွက် အားကိုပါတယ် ရှင်းပြပေးလို့ရမလား ဘာလုပ်ရမလည်းဗျာ
phpmailer() လည်းမသုံးချင်ဘူး
<?php
$to = "somebody@example.com, somebodyelse@example.com";
$subject = "HTML email";
$message = "
HTML email
This email contains HTML Tags!
Firstname
Lastname
John
Doe
“;
// Always set content-type when sending HTML email
$headers = “MIME-Version: 1.0” . “\r\n”;
$headers .= “Content-type:text/html;charset=iso-8859-1” . “\r\n”;
// More headers
$headers .= ‘From: ‘ . “\r\n”;
$headers .= ‘Cc: myboss@example.com‘ . “\r\n”;
mail($to,$subject,$message,$headers);
?>
တကယ့်ကို ကျေးဇူးတင်ပါတယ် ကူညီပါဗျာ
PHPMailer is a only way. php mail can’t use SMTP. You need to setup SMTP in your server if you want to use with mail function
Sai Myo Myat,
Mail becomes flagged as spam from GOOGLE is nothing related with sendmail function. It can be mostly because of the following facts.
1. You are trying to sending email with different domains. For example, your DNS is test.com and your MX is associated with test.com, but in your send mail from headers, you set different domain which is not connected like testing.com. In that case most of the mail server will flag as spam.
2. Your mail server is probably black listed. Ask your hosting provider for details.
3. Your mail server may not have SPF records. Most of the mail service like google, msn, yahoo, they usually check whether your mail headers came up with SPF record. FYI: http://en.wikipedia.org/wiki/Sender_Policy_Framework
There are still more factors why your send email has been marked as spam.