I write a script to send email from my website. I recieve email in inbox in gmail, outlook and hotmail but in yahoo, its going to SPAM folder and also URL in not working in yahoo. Whats wrong in my code,
Header
$headers = "MIME-Version: 1.0 \r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1 \r\n";
$headers .= "From: $Name <$Email> \r\n";
$headers .= "Reply-To: $Email\r\n";
Message with URL
$message.= "<a href='https://www.google.com'>Click here</a>";
PHP-Mail function is not uses a well configured SMTP Server so may be this is a reason or try to Use the PHPMailer-Class. or you need to try with full headers
Also links not working cause your mail in spam. need to move in inbox and see.
http://www.velvetblues.com/web-development-blog/avoid-spam-filters-with-php-mail-emails/
For more info follow:- sending email via php mail function goes to spam
Related
My goal is to anwer to a mail to a email that is in a inbox of a mailbox.
I am at the point that I can read the mail out of the mailbox and I can send emails.
The only thing is that I would like it for the receiver of the email that all the conversations are wrapped in 1 email. You know with gmail you see for example a subject like this:
(5) Test subject
This means that this mails contains 5 submails.
But at this point everytime I send a answer to the existing email with php it comes in as a completely new mail. And it does not stack on top of eachother.
Does anyone know how to make these emails stack on eachother.
My current code for sending the mail:
// To send HTML mail, the Content-type header must be set
$headers = "MIME-Version: 1.0 \r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1 \r\n";
$headers .= "Reply-To: reply#reply.nl \r\n";
// Additional headers
$headers .= "From: sender#sender.nl\r\n";
mail("test#test.nl", "test subject", "test message", $headers);
You have to include the In-Reply-To and the References Header.
In In-Reply-To is the Message-ID-Header you are directly refering too and References are commaseperated values of all messages (e.g. when you reply back and forth, then it would make sense to include all of the message IDs)
Example:
In-Reply-To: <GDKDHK#web.de>
References: <a1gjkr#googlemail.com>,<GDKDHK#web.de>
You need to RE: subject so that they can stack in the email viewer.
This question already has answers here:
Prevent sent emails treated as junk mails using php mail function
(14 answers)
Closed 9 years ago.
I used this tutorial for sending mail :
http://www.velvetblues.com/web-development-blog/avoid-spam-filters-with-php-mail-emails/
My code looks like this :
$headers .= "Reply-To: The Sender <sender#sender.com>\r\n";
$headers .= "Return-Path: The Sender <sender#sender.com>\r\n";
$headers .= "From: The Sender <senter#sender.com>\r\n";
$headers .= "Organization: Sender Organization\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-Mailer: PHP". phpversion() ."\r\n"
mail("recipient#recipient.com", "Message", "A simple message.", $headers);
I am using localhost(MAMP PRO) for sending mail.
But mail goes to spam folder.How to send mail which goes to inbox.Please guys help me out from this,i spend a lot of time on it.
Which folder an email goes into depends mostly on the domain & ipaddress from which the email is coming from and the email service provider. If your domain/ip is trusted by the service provider it will not be spammed.
Also, after setting a few emails as "Not Spam" from that domain, your email service will no longer spam the emails
there are more than one reason ur email goes to spam ...
1 - make sure that the "from email" is actually the email u are sending the emails from .. i mean dont use any other false "from Email"
2- you have to keep the message body simple as possible . dont use so much html tags and css experssions , and also try to use tables
Hi can anyone help why can't I send email to a gmail account.I have been doing change password module and to confirm the password i will send the confirmation link to my clients email account.Many have contact me that they have not receive any emails. Here's my code:
$headers .= "MIME-Version: 1.0 \r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1 \r\n";
$headers .= "From: ".$from;
mail($sendmail_recipient_email, $sendmail_subject, $sendmail_message, $headers);
Well for one, your $headers are just going to be
"From: ".$from;
because you're not using a concatenation operator. Should be:
$headers .= "From: ".$from;
note the .=
EDIT
The OP corrected the code in the question, so I'll modify my answer. There are LOTS of reasons that gmail might be rejecting your emails, but a good first step would be to remove the \r line-break modifiers. \n should suffice, and lots of folks seem to have solved this exact issue (specific rejection by Gmail) by only using new-line breaks and excluding return breaks.
I have set automatically to send email to users from my website. but this email will place to spam of users with gmail accounts.However it is working fine with yahoo or hotmail accounts.
How should I solve this?
$to = "$Email";
$subject = "Greeting";
$message = 'message here';
$from = "sender#example.com";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "From: sender#example.com" . "\r\n" .
"Reply-To: sender#example.com" . "\r\n";
mail($to,$subject,$message,$headers);
Since your headers appear to be correct, it's probably keying on something within the message. One of the things that SpamAssassin (no idea if this is what Gmail uses) keys on is a very short message like the above containing a hyperlink or graphic, so you may benefit by actually making your message a little longer. One of the ways to find out is to send it to your own gmail account and when it appears in your spam folder, examine the headers there for any added spam information. It may contain clues as to what spam engine Gmail is using or what rules your message is breaking.
Please have a look here:
Spam sent to Contacts -
Message Delivery
Hope this helps!
it should be of smtp configuration email and site information email id should be diffrent.
I am trying to send new system generated password using mail() in php. The thing is I am able to send it to yahoo but when I use gmail or hotmail I dont receive any emails although the function returns true. Following is the function:
if(mail($to,$subject,$body))
{
return true;
}
else
{
return false;
}
It probably ends up in the spam folder look there. If its there make sure your email headers are perfect.
You could look into librairies for what you want to achieve. Zend_Mail has everything you could need to connect to gmail and others.
If you are getting the mail successfully through yahoo, you should also post the headers that are coming through from yahoo here in the question. My bet is you will need to include a "from field" also to get through on hotmail, gmail, etc...
Your problem might be the antispam filters. E-mails sent from PHP are usually marked as spam by the mail servers and end up deleted or in the spam can.
You can Google for "php mail spam" to get some hints of how to work around this issue.
Maybe you're on a shared server and the IP is banned/blocked due to spamming by other users (websites) of your server.
Try adding SPF records.
Ensure that your envelope-FROM (a.k.a. return path) is set to a valid email address that you have access to. If you're not seeing the message in the spam folders, it should be getting bounced; the bounce message may offer a clue as to why the mail is not getting through.
I would try to include your own headers in your mail function
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Date: ". date('r'). " \r\n";
$headers .= "Return-Path:youremail#domain.com\r\n";
$headers .= "Errors-To:youremail#domain.com\r\n";
$headers .= "From:youremail#domain.com <youremail#domain.com>\r\n";
$headers .= "Reply-to:youremail#domain.com \r\n";
$headers .= "Organization: YourOrg \r\n";
$headers .= "X-Sender:youremail#domain.com \r\n";
$headers .= "X-Priority: 3 \r\n";
$headers .= "X-MSMail-Priority: Normal \r\n";
$headers .= "X-Mailer: PHP/" . phpversion();
mail($to,$subject,$body,$headers);
Try checking if your mailserver ip is blacklisted anywhere?
http://www.mxtoolbox.com/blacklists.aspx
If not, try harder with the headers that are being sent with the mail.