Sending email using mail() function in PHP - php

I am sending email using mail() function from my CentOS server. I am able to send using anyone's name without any authentication. For example, I am able to send email using my email address (abc#gmail.com -- say), my friend's email address (xyz#gmail.com -- say) or any other email address (billgates#microsoft.com -- say).
When someone receives my email from PHP code, it looks exactly like it was sent from the email address that I wanted to send from. I am using this PHP class for sending emails.
My question: How to prevent an email to be automatically marked as spam by the email service provider of the receiver (Gmail, Hotmail, MSN, Yahoo etc.)?
As of now, I have only option for sending email using mail() function only. My authentication code is not working.
Note: I am not going to do any spamming. My web application going to send emails to users who are creating new accounts on my website. And hence, I don't want email from my server to be automatically marked as SPAM by their email service provider (Gmail, MSN, Hotmail, Yahoo etc). I don't want my email to go directly to their SPAM folder instead of their Inbox.

You should use the domain name of your website as E-mail address e.g. noreply#mydomain.com. Because some mail servers will do a dns lookup for the domain stated in your e-mail address or even a reverse dns lookup. Since gmail.com does not resolve to the IP of your webserver the e-mail may get marked as spam. There are many other factors for an e-mail to become spam.
For example HTML formatted mails (especially when containing external images) are more likely to get marked as spam than plain text mails.
Also make sure to use proper Mail headers for your mail, they may also be validated by the remote mail server.

Related

Why php mail() function does not require any authentication?

i am working on a project and i have to send mails. I noticed, that it was possible to set "From" to any email address without any kind of authentication (like password). Why is that possible and is this not a lack of security?
Sending a mail from my private domain as the "Sender" was possible and this mail was not marked as spam by the client..
Is it possible to prevent sending mails from the domain?
Yes, email headers can be #microsoft.com for example, but microsoft must have a SPF record on it, to indicate that your server is authorized to send messages with their domain. So, if you don't have authorization, it will be marked as spam by most email clients or you will be advised than message is fake .

php sendmail() from same domain - is it considered SPAM now?

I want to know if using PHPmailer functions to send HTML or plain emails
would be not considered as SPAM by mail servers if it would originate
from the domain with the same name.
For example :
sending email with PHPmailer as "info#mydomain.com"
originating from "mydomain.com" domain (as opposed to say GMail server or other mail servers).
I have a "password lost" system that sends emails to people using my website/portal
and so far i tested the function with my GMail account. I wonder that when I will move
to new hosting, linux box, and configure the domain on that box, and add a mail account and use PHPMailer locally, with that mail account, maybe it would be totally cleaner and will not go in SPAM folders when I sent mails.
Let me know your thoughts about it,
and if this really works
thanks,
Your mails originating from yourdomain.com sent as info#yourdomain.com will not be marked with "using domain yoursharedhostingdomain.com" in gmail, so mails shouldn`t drop in the spam folder for that reason.
With Gmail here i mean e-mail client, not using gmail account as a sender.

PHP mail- a specific from address- the email never arrives

I am using PHP to send emails using mail.
Now I am sending it with a from address being my domain. This works fine when sending from any email address # said domain (such as abc#domain.com, fff#domain.com), but their is 1 certain address that just doesnt work.
When I send it from the email reports#domain.com (which is an email account that exists), the error logs look fine, but the email never arrives. Not in spam or anything.
Why would it be that a certain from email address is failing? I'm not sure if this is a problem with sendmail or PHP.
I've checked the settings of the reports email account and they all look the same as every other account that does work so im not sure where to start looking.
Please check your Reverse DNS, SPF and Domain Keys of your mail server and your domain
Utilize the followings #
Debouncer
MXToolBox
intoDNS

fail: sending mail to facebook email adress with php mail() function

my mail system working well. hotmail, gmail or etc are not moving my server's sent mails to "spam" folder but there is something else : facebook mail.
I'm getting user's email when they are login to my website with facebook. After that I have to send email to their facebook.com email. I'm sendin but it's going into directly "Other messages" box. It's not shown on normal "Messages" box.
It's awful because there is no boarding for that new email user had received.
What is the solution?
Your emails are being flagged as spam in Facebook. No one really knows how Facebook will mark email as Spam but if you Google, there will be many ways you can avoid being detected as spam.
As I do with all my email, go through Postmark for my software, or SMTP.com for business mail. Sending it from your server, which I imagine is on a shared host, will alone almost always flag you as SPAM in many system.

Is it possible with PHP mail to send an email to a specific IP address?

We have a client that can't receive emails from a dedicated server using PHP mail because when their SPAM server does an MX record lookup for the IP it can't find one (so it bounces the email).
This is because the mail exchange is on a different server completely. The client said that they have an IP address that bypasses the SPAM blocker.
So I'm wondering if PHP mail can send an email to a specific IP?
Does your server not qualify as a mail sender by their spam filter? Because I'm guessing that they can receive mail from other people.
So I think you need to look at the setup of your server so it complies with their qualifications (like a reversible name for example, or whatever other rules they require from an email sender)
Because with PHP (and other languages) you just send the email, there are tools that send an email through another server that is qualified to send emails, but usually you use the server itself.
For example, you can use the Zend Mail library to send through another SMTP server.
The answer is yes. However, how the mail() call in PHP actually sends the mail is totally dependent on how your system is set up, so any problems you're having sending mail won't be resolved in your PHP code, they'll be in your mail set up.
Generally, you should be able to address a piece of email to "user#192.168.1.1" and have it arrive successfully.
There's a good article about some of your mailer settings here.

Categories