The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
Swift Mailer Module & Gmail SMTP - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Modules / Other (https://forums.formtools.org/forumdisplay.php?fid=8) +--- Forum: Modules (https://forums.formtools.org/forumdisplay.php?fid=16) +--- Thread: Swift Mailer Module & Gmail SMTP (/showthread.php?tid=129) |
Swift Mailer Module & Gmail SMTP - Chuck - Apr 27th, 2009 This thread describes a way to use FT2 and the Swift Mailer module with SMTP to a Gmail account. It described changes to files in the Swift Mailer module v1.0.0-beta-20090409. It enables FT2 to meet the following Gmail requirements: 1) use a SSL (not TLS) encrypted connection to Gmail SMTP 2) authenticate to your Gmail account 3) use the Swift Mailer batchSend function which defaults to only show the individual's To: address on each email and suppress the others in the list (ignores the CC: and BCC: fields) 4) use the Swift Mailer anti-flood function to limit outbound emails to 100 or less per connection First go into the Modules section and select Swift Mailer. Update the following values: Enabled - Yes SMTP Server - smtp.gmail.com Port - 465 Requires authentication - Yes Username - example@gmail.com Password - your Gmail password Authentication procedure - LOGIN Next we need to makes 4 changes to the following file. formtools/modules/swift_mailer/library.php - change 1 of 4 This change requires (adds) the anti-flood class included with the Swift Mailer modules for later use in the script. change this: Code: // include the main files Code: // include the main files formtools/modules/swift_mailer/library.php - change 2 of 4 This change creates a SSL encrypted connection to Gmail. Notice I commented out the previous line. Gmail offers port 465 for SSL and 587 for TLS encrypted connections. I read that Swift Mailer supports SSL, not TLS, but that information may be dated now. change this: Code: if (empty($port)) Code: if (empty($port)) formtools/modules/swift_mailer/library.php - change 3 of 4 This change brings the anti-flood code into play so you don't exceed Gmail's 100 emails per connection limit. This setting sends out 90 emails per batch then waits 2 seconds before opening up the next connection if needed. change this: Code: if ($settings["requires_authentication"] == "yes") Code: if ($settings["requires_authentication"] == "yes") formtools/modules/swift_mailer/library.php - change 4 of 4 This change uses the batchSend() instead of the send() function. Notice I commented out the previous line. This will cause individual emails to be sent with just the recipient's email in the To: field. It will not send the entire email list to each recipient. The CC: and BCC: fields are ignored with batchSend(). change this: Code: $swift->send($email, $recipients, $from); Code: // $swift->send($email, $recipients, $from); Finally we need to make 1 change to the following file. formtools/modules/swift_mailer/php5/ft_library.php - change 1 of 1 This change is not required unless you want to use the test functions. Notice I commented out the previous line again. change this: Code: if (empty($port)) Code: if (empty($port)) Hopefully this thread will help others looking to use Gmail as their SMTP server. It will work well for an email list with only 1 address to very long lists. Keep in mind that if you try to use this technique to send spam that Gmail will identify the activity by the higher rate of returns and rejects and lock your account for 24-48 hours. Abuse this at your own risk! YMMV! Chuck RE: Swift Mailer Module & Gmail SMTP - Ben - Jul 11th, 2009 Terrific post, Chuck. It's rather tempting to add your code to the module, but I am a little worried about people using it for spam... though I suppose Google are watching for it. RE: Swift Mailer Module & Gmail SMTP - sujith - Sep 10th, 2009 Ben. My swift mailer was working fine with gmail till day before yesterday. But from yesterday onwards, the form submission goes to an error page that says. Fatal error: Uncaught exception 'Swift_ConnectionException' with message 'The SMTP connection failed to start [tls://smtp.gmail.com:465]: fsockopen returned Error Number 110 and Error String 'Connection timed out'' in /home/kerala36/public_html/formtools/modules/swift_mailer/php5/Swift/Connection/SMTP.php:309 Stack trace: #0 /home/kerala36/public_html/formtools/modules/swift_mailer/php5/Swift.php(216): Swift_Connection_SMTP->start() #1 /home/kerala36/public_html/formtools/modules/swift_mailer/php5/Swift.php(101): Swift->connect() #2 /home/kerala36/public_html/formtools/modules/swift_mailer/library.php(196): Swift->__construct(Object(Swift_Connection_SMTP)) #3 /home/kerala36/public_html/formtools/global/code/emails.php(1102): swift_send_email(Array) #4 /home/kerala36/public_html/formtools/global/code/emails.php(1070): ft_process_email_template('2', 2, '4') #5 /home/kerala36/public_html/formtools/process.php(317): ft_send_emails('on_submission', '2', 2) #6 /home/kerala36/public_html/formtools/process.php(49): ft_process_for in /home/kerala36/public_html/formtools/modules/swift_mailer/php5/Swift/Connection/SMTP.php on line 309 I haven't made any changes with the configuration or anything. please guide. RE: Swift Mailer Module & Gmail SMTP - sujith - Sep 11th, 2009 when testing the SWIFT MAILER , i am getting the following error. There was a problem communicating with SMTP: The SMTP connection failed to start [tls://smtp.gmail.com:465]: fsockopen returned Error Number 110 and Error String 'Connection timed out' RE: Swift Mailer Module & Gmail SMTP - titooooo - Aug 25th, 2011 Hi, How you solve it , i got same error regards. (Sep 11th, 2009, 12:07 AM)sujith Wrote: when testing the SWIFT MAILER , i am getting the following error. RE: Swift Mailer Module & Gmail SMTP - xoxo - Nov 22nd, 2011 Hello, I'm having exactly the same error. Code: There was a problem communicating with SMTP: The SMTP connection failed to start [ssl://smtp.gmail.com:465]: fsockopen returned Error Number 110 and Error String 'Connection timed out' Also, in module I'm entering the correct values for my SMTP server, and the same... Code: There was a problem communicating with SMTP: The SMTP connection failed to start [tls://mail.mydomain.com:587]: fsockopen returned Error Number 0 and Error String '' I know the values are correct, because I'm using them also in Livezilla. Is anybody getting the same errors? RE: Swift Mailer Module & Gmail SMTP - michatmaster7 - Nov 22nd, 2011 I'm getting the same error "110" during the test. I'm at a total loss. Anyone? Just an update, I'm getting this error message when using any SMTP configuration NOT hosted on the same domain as my FT installation. Not just Gmail. I've submitted a ticket to my web host to see if the problem is on that end. Will update when I find out. Final update for everyone. I heard back from the web host, who said: Quote:The secure port(465) in the firewall was not allowed for outgoing connections. They enabled it and it works flawlessly now. YAY! RE: Swift Mailer Module & Gmail SMTP - Ben - Nov 22nd, 2011 Very good to hear! btw, I'm going to sticky this post - I see it's at 10,000+ page views (!?); clearly it's of interest to people. - Ben RE: Swift Mailer Module & Gmail SMTP - xoxo - Nov 25th, 2011 Nice! But opening the secure port(465) port, only makes now the GMail smtp to work. Can I kindly ask you, Ben, that you provide us with a list of the ports Swift Module uses to connect on? I really want to use my own SMTP server. Thank you!! RE: Swift Mailer Module & Gmail SMTP - BillDOH - Jul 30th, 2012 I'm having this same issue/error. I've tried changing code where applicable, and now have reverted back to the stock code. My Host says that port 465 is open for ssl connections outbound to any SSL enabled SMTP connection. I still get the same error. It doesn't matter if I use a local SMTP on the host or anything outside, I get this same error. Anyone else got any ideas of where to look or other possible solutions? It doesn't work in either the test mode inside swift mailer, or with forms. PHP mail will work but only with addresses within the domain, and I need to be able to send attachments. I also tried the gmail route - established an account and made all changes accordingly, but no luck there either. DOH!! I dunno where to go from here.... Peace, Bill |