Google Apps hosted email questions.
Posted: Mon Jun 11, 2007 5:59 am
Howdy. Swiftmailer 3.2.6 on PHP5.1/Gentoo.
I've had google apps set up for a while already, believe I signed up early in it's beta.
I also have a gmail account.
Here's the code snippet for my tests:
It works just fine as is, but I've got a question on proper configuration:
Google Apps is set up to use aspmx.l.google.com. Should I be using this for my SMTP server, or stick with smtp.gmail.com/smtp.googlemail.com?
d11wtq, thanks so much for spending so much time and effort on this; hopefully when I can get my hands on some cash I can send you a couple bucks for your trip. Oh, and awesome docs; just one thing -- I had to page through several pages before I was able to patch this together, any chance of a simple named wiki page with GMail/Apps direct instructions, as this seems to be a very popular use of Swiftmailer?
Cheers!
I've had google apps set up for a while already, believe I signed up early in it's beta.
I also have a gmail account.
Here's the code snippet for my tests:
Code: Select all
<?php
require_once "swiftmailer/Swift.php";
require_once "swiftmailer/Swift/Connection/SMTP.php";
echo "Starting...\n<br>\n<br>\n";
// Create a SMTP connection handler object (Google Apps for your Domain)
$smtp = new Swift_Connection_SMTP("smtp.gmail.com",
Swift_Connection_SMTP::PORT_SECURE, Swift_Connection_SMTP::ENC_TLS);
$smtp->setUsername("phpsmtp@sllabs.com");
$smtp->setpassword("areallycleverpassword");
// Create the Swift object interface
$swift =& new Swift($smtp);
// Set up the test email to send
$to = "513d65af-98e3-f2ef-db09-9a112eca5d28@lsl.secondlife.com";
$subject = "Testing my subject";
$message = "A very long\n and drawn out\n message.\n\nRar!";
// Craft the message
$swiftmessage =& new Swift_Message($subject, $message);
// See Swiftmailer. See Swiftmailer mail. Mail, Swiftmailer, mail!
if ($swift->send($swiftmessage, $to, "phpsmtp@sllabs.com"))
{ echo "Sent"; } else { echo "Failed"; }
?>Google Apps is set up to use aspmx.l.google.com. Should I be using this for my SMTP server, or stick with smtp.gmail.com/smtp.googlemail.com?
d11wtq, thanks so much for spending so much time and effort on this; hopefully when I can get my hands on some cash I can send you a couple bucks for your trip. Oh, and awesome docs; just one thing -- I had to page through several pages before I was able to patch this together, any chance of a simple named wiki page with GMail/Apps direct instructions, as this seems to be a very popular use of Swiftmailer?
Cheers!