Support for SMTP over TLS (STARTTLS) |
[eluser]Unknown[/eluser]
My SMTP provider (Exchange system) doesn't accept SSL connections and requires the use of SMTP over TLS instead (STARTTLS, RFC 3207). Here is a small patch to the Email class which adds support for it. It is written against 1.7.2. If this is useful to others, you're most welcome to incorporate it in a future release. Usage: Specify server settings as a regular SMTP server (tcp://servername, typically port 25 or 587). Enable new setting in config ($config['starttls'] = TRUE Depends on TLS being available (i.e., listed in the 'Registered Stream Socket Transports' section of phpinfo()). Patch Code: --- a/system/libraries/Email.php Example: Code: <?php
[eluser]matt2012[/eluser]
This was the cure for my google mail problems. Thanks for this I have added your changes to a library to override the built in Class. MY_Email in libraries Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed.');
[eluser]matt2012[/eluser]
For those who come looking I was actually able to fix the google issue simple by adding Code: 'smtp_timeout' => 30,
[eluser]Miles[/eluser]
As of 2.1.0, you can accomplish this without extending the Email class... Solution: For TLS: $config['smtp_crypto'] = 'tls'; For SSL: $config['smtp_crypto'] = 'ssl'; Tested it today and it works great!
[eluser]Unknown[/eluser]
[quote author="Miles" date="1330031943"]As of 2.1.0, you can accomplish this without extending the Email class... Solution: For TLS: $config['smtp_crypto'] = 'tls'; For SSL: $config['smtp_crypto'] = 'ssl'; Tested it today and it works great![/quote] I'm running into this issue now. Has this config variable been confirmed? I'm still having trouble over all with getting Freeform (and by extension email sent through the Communicate tab in the CP) and I'm just trying to eliminate things like this so their Exchange Server admin can stop blaming EE and start looking into this from his end. I did have to hack the CI email library to overwrite the port (587 instead of 25) and I had to change the newline and crlf variables to /r/n instead of just /n. Anything else I might have missed? Any other changed to the CI email library that need to be made? Other hidden config variables that need to be set?
[eluser]Miles[/eluser]
[quote author="stubear" date="1360770613"][quote author="Miles" date="1330031943"]As of 2.1.0, you can accomplish this without extending the Email class... Solution: For TLS: $config['smtp_crypto'] = 'tls'; For SSL: $config['smtp_crypto'] = 'ssl'; Tested it today and it works great![/quote] I'm running into this issue now. Has this config variable been confirmed? I'm still having trouble over all with getting Freeform (and by extension email sent through the Communicate tab in the CP) and I'm just trying to eliminate things like this so their Exchange Server admin can stop blaming EE and start looking into this from his end. I did have to hack the CI email library to overwrite the port (587 instead of 25) and I had to change the newline and crlf variables to /r/n instead of just /n. Anything else I might have missed? Any other changed to the CI email library that need to be made? Other hidden config variables that need to be set?[/quote] Stubear, which version of Codeigniter are you running? The port and new line can be set in the config and do not need to be edited in the core files at all. I've put an example of how I'm accomplishing the TLS on this pastebin link http://pastebin.com/pu9YiMfL I hope this helps |
Welcome Guest, Not a member yet? Register Sign In |