0
votes

I've already setup an SPF TXT record for my Google Apps mail and everything's a-ok, but I need to send email from my webapp using php's mail(), so I need to add my host's domain (say entity.ca) as a permitted sender. How do I do this?

If the original record from Google Apps docs is v=spf1 include:_spf.google.com ~all, will the following be correct for adding my domain:

v=spf1 a:entity.ca include:_spf.google.com ~all

sorry, I found http://www.zytrax.com/books/dns/ch9/spf.html and What should I use for SPF record of my domain? on Google but it's quite confusing.

Thanks, y'all.

2

2 Answers

0
votes

That is not possible. Simply use a nice smtp lib and send your mails via the google mail smtp servers.

require_once "Mail.php";

$from = "Sandra Sender <[email protected]>";
$to = "Ramona Recipient <[email protected]>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

$host = "mail.example.com";
$username = "smtp_username";
$password = "smtp_password";

$headers = array ('From' => $from,
   'To' => $to,
   'Subject' => $subject);
$smtp = Mail::factory('smtp',
   array ('host' => $host,
     'auth' => true,
     'username' => $username,
     'password' => $password));

$mail = $smtp->send($to, $headers, $body);

if(PEAR::isError($mail)) {
    echo("<p>" . $mail->getMessage() . "</p>");
} else {
    echo("<p>Message successfully sent!</p>");
}

[Source and more infomations]

0
votes

using http://www.kitterman.com/spf/validate.html (with the help of http://www.gadgetwiz.com/network/netmask.html), here's what I came up with:

v=spf1 ip4:68.178.232.100 include:_spf.google.com ~all

hope this helps out anyone in the same pickle. :D