[SOLVED] Google Apps Email Issue

I'm using google apps for email and have noticed that I'm having issues with the mail() function of php. The library article for using google apps doesn't address SPF records, but I'm thinking that's the cause, a friend of mine did some testing and was able to send to an @gmail address without issue, but to a couple other emails it failed, and it's failing to send me mail on the same domain it's on. I also stumbled across this but am unsure of exactly how to interpret it, I'm not that up on DNS knowledge

Edit: forgot the domain, will probably help… thesoonergeek.com

8 Replies

try setting your spf record exactly as google says you should for a start.

v=spf1 include:aspmx.googlemail.com ~all

Using '-all' instead of '~all' is specifically frowned upon in the very google docs.

Hope it helps.

Thanks, I used a script that used the Linode API to set it up and that's what it set initially I left it due to lack of knowledge, and once reading the article I linked didn't change it to what google recommended due to the issue it talked about with mail being marked as spam with that specific SPF. I'll try that and go from there, thanks.

Okay, so I've made the change suggested and it's still not making into my email

I have a txt record of

v=spf1 include:aspmx.googlemail.com ~all

and its sending fine, I also just migrated all my dns from slicehost to linode and have been sending emails last few days without issue.

do you have your google mail CNAME + MX records set up correctly?

Yeah, my MX and CNAMEs are set up correctly.

Stu, the mail() function sends to your Google hosted mail on the same domain just fine?

yep.

";

$message="Hello test foo\r\n";
$message.="another line to send\r\n";
$message.="test sample message";

$sentmail = mail($to,$subject,$message,$header);

if($sentmail){
    echo "Email Has Been Sent .";
}
else 
{
    echo "Cannot Send Email ";
}
?>

worked fine. I sent a test mail to my work email from my domain to verify outside with a non gmail/google mail setup domain. also tested as loopback to myself in gmail and again no problems so I know its being delivered internally and externally.

I use msmtp as my MTA. also verified using redmine (ruby) to send email.

hmm, so I'm wondering if it's actually my MTA (postfix) that's causing the issue. I don't know why I didn't check mail.log before :oops: but I'm showing the following:

/var/log/mail.log.0:Dec 16 14:40:34 ubuntu postfix/error[17864]: A222716066: to=<user@mydomain.com>, relay=none, delay=0.19, delays=0.08/0.02/0/0.09, dsn=5.0.0, status=bounced (User unknown in virtual alias table)

Okay, I found a tip to comment out virtualaliasdomains in main.cf and remove the domain from mydestinations= and it would forward to the MX. This worked and mail is now being send to google apps appropriately

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct