View Full Version : Google Apps for your Domain (PHP mail forms)
jcmaco
02-05-2007, 01:14 PM
Every since I've transfered the MX records to Google, my php mail form no longer works. The function used in the script is mail() and the php.ini file uses sendmail.
Is there a way to use Google's secure SMTP (TLS)?
The script I am using is the "Secure PHP Form Mailer Script" (http://www.dagondesign.com/articles/secure-php-form-mailer-script/) by Dagon Design.
areidmtm
02-05-2007, 01:43 PM
Yes but it's a pain, check out http://www.swiftmailer.org/. Your mail() function still should work. Just make sure that the email address that you're sending from still exists in cPanel and your code looks something like this
$to = "you@domain.com";
$subject = "SUBJECT";
$message = "Hello! \n";
$message .= "More blah blah blah \n";
$message .= "blah blah blah blah blah blah blah blah blah \n";
$headers = "From: me@domain.com \r\n" .
"Reply-To: me@domain.com \r\n" .
"X-Mailer: PHP/" . phpversion();
mail($to, $subject, $message, $headers);
I've changed my MX records and I still can use the mail() function, as long as the email exists.
agcssautomotive.com
02-05-2007, 01:44 PM
Is it able to work if you dont include from address?
orangecoat-ciallella
02-02-2008, 01:22 PM
I've had the issue of being able to use the PHP mail() function to send contact form messages to addresses other than my own domain name. It turns out, if your email inboxes are hosted with an outside email, like Google Apps, then you need to modify some settings in cPanel so it knows how to route your domain's email to that outside mail handler.
So, if you have me@domain.com and you try to send from your domain.com server and the message seems to disappear then try this.
In cPanel, under Mail >> Mx Entry add any/all the MX records for the domain and set the "Always Accept" option to No.
This allows mail sent to the same domain to be delivered to the normal inbox, instead of being trapped in the server's local mailbox for that domain email address.
Also, if you still can't get the mail() function to work and you use SwiftMailer to send email with STMP then you'd need to be sure port 465 is open. You'll get some sort of fsocketopen error if it's not open. If you have a VPS and WHM access then you may be able to open ports for the server using the Firewall Configuration. If you're on shared hosting you'd have to contact support and see if they'll open port 465 for secure TLS access to Google's server.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.