Domain's email account with phpMailer and Gmail - php

Two scenarios:
I recently downloaded the phpMailer and added it to my public_html folder.
I add my domain's email accounts to my gmail account.
Two problems:
When sending emails (domain's email account) using phpMailer and Gmail, and when the recipient received it, the red question mark is appearing instead of the Gmail's default profile photo.
What do I need to do to solve this? I searched about in phpMailer that I need some DKIM and SPF keys or something.

Your message is not authenticated, you must set a SPF configuration this is a TXT record on your domain (envelope). For Example "v=spf1 ip4:204.200.197.197 -all" means the ip 204.200.197.197 is allowed to send mails over your domain.
more information to gmail red question mark
https://support.google.com/mail/answer/180707?vid=0-1292648286207-1480402255906&hl=en
more informations to spf records
http://www.openspf.org/FAQ/Examples

Related

Php send mail with gmail and SPF record handling

I use the Swiftmailer lib to send mail in php, such as:
$transporter = Swift_SmtpTransport::newInstance('smtp.gmail.com', 587, 'tls')
->setAuthMode('login')
->setUsername('username#gmail.com')
->setPassword('password');
$mailer = Swift_Mailer::newInstance($transporter);
I use Gmail Workplace and am trying to understand and setup SPF at my webb host (not Google). Should I setup a gmail SPF or an SPF for my own IP adress to avoid having mails sent via php on my server, but with gmail SMTP, marked as spam?
You're already authenticating with credentials against smtp.gmail.com, so your own IP address is irrelevant for SPF configuration. SPF is checked by receiving servers, where the IP address of the connecting server (Google) is checked against the SPF list in the domain found in the Return-Path header.
Google is then relaying your message to it's destination recipient(s) on your behalf. Thus Google's IP should be in the SPF record for the domain you use in the Return-Path header (a.k.a. bounce address or smtp.mailfrom).
So, to answer your question: For the domain you use to send email from (as the Return-Path address), you should include the gmail servers as authorized hosts. Assuming you don't use any other services, that SPF record would look like:
"v=spf1 include:_spf.google.com ~all", as described in this Google support article.
And as per Jake's comment, indeed you should consider implementing DKIM and DMARC as well, because relying on SPF alone for protection against spoofing is not sufficient and is not resilient against email forwarding. The same documentation, a few levels up, lists all required actions to accomplish that.

PHP Mail SPF failure

We have a problem using PHP mail on a shared hosting server on 1and1.com
We use SPF entries in our TXT DNS settings which include the email servers we use also confirm that outgoing emails are sent from our domain email addresses.
The scenario is: We have a button feature that allows site users to send a personal email from their email address to a client email address.
The problem is: These emails either bounce or end up in SPAM because they do not pass the SPF test.
Although I realize that we can solve the problem with a dedicated server, I was hoping someone had a solution or a way that we could solve the problem and still remain on shared hosting.
Thanks!

Change FROM header of email without being marked as spam

So I'm not having much luck finding information on how to send email with custom From header without being potentially marked as spam (for email spoofing).
The reason we want to do this is we run a server for many client's websites, but we don't host their emails is most cases.
We wish to send enquiry emails from the websites using their preferred address (e.g. sales#mycompany.com) so that their customers can reply to the email.
At the moment we're using a Google Apps email address and changing the Reply-To header, but this is ignored by Outlook almost all the time (not sure why).
In most cases we have access to the DNS records, so is it as simple as adding our server's IP address to the domain's SPF record?
Or should we look at a third-party solution for this?
Thanks in advance!
Yes you need to add SPF records to the DNS TXT record.
So if you want to send an E-mail as user#foo.bar from IP address 192.168.3.4 you need to create (if you are not the admin of foo.bar) a DNS TXT record/s for foo.bar as such
v=spf1 +ip4:192.168.3.4 -all
This tells the remote server that the foo.bar domain sends legitimate email from 192.168.3.4 and that all other sources are only pretending to be foo.bar.
Note that the IP can be either ip4 or ip6.

Error sending emails from PHP with PHPMailer

I need your help! I have a code in PHP for sending emails (PHPMailer version 5.2.7). Send email from PHP, I use this method usually.
I explain me...
The mails sent go directly to SPAM folder to Hotmail, Gmail...
I have my own server with two domains (unique IP for two domains). In the domain1 the mails sent correctly (PHPMailer 5.2.7) and go directly to de inbox folder. In the domain2 the mails sent correctly but mails go directly to SPAM folder (PHPMailer 5.2.7)!!
Which is the difference between domain1 and domain2?? Have the same ip...
I can do mailings to domain2 not reach the spam folder?
P.D.: Shipping method in PHPMailer is SMTP with user and pass verified.
There could be multiple factors that results in mail getting routed to spam folder. I don't think, it is anything to do with PHPmailer. It is something to do with your IP reputation, complaints, activity, user engagement and some other factors.
One reason could be, that your mail server uses only one ip to send from.
Maybe the the reverse lookup from that ip resolves to your domain1.
Also related are dkim and spf records.

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.

Categories