Way to monitor attempt to send email?

Started by Josh @ Dreamland, October 18, 2017, 12:41:33 AM

Previous topic - Next topic

Josh @ Dreamland

Hi all,

I'm trying to configure my board to send mail through Gmail. I've done a lot of digging, and found that the correct configuration should be as follows:


SMTP server:ssl://smtp.gmail.com
SMTP port:465
SMTP username:[email protected]
SMTP password:gmail-password

Unfortunately, this isn't working. More digging suggested that the problem was that the PHP OpenSSL module wasn't being loaded, but this is not the case ("openssl" appears in the output of `php --modules`).
I checked basically everything under /var/logs... nothing relevant is being written there. Nothing in maillog nor tt]error_log[/tt].

I tried different schemes under "server." In addition to `ssl://,` I have tried tls, tlsv1.0, tlsv1.1, and tlsv1.2. The lattermost actually generated a useful error:

[Wed Oct 18 00:10:24.985993 2017] [:error] [pid 13137] [client 98.239.128.47:48240] PHP Warning:  fsockopen(): unable to connect to tlsv1.2://smtp.gmail.com:465 (Unable to find the socket transport "tlsv1.2" - did you forget to enable it when you configured PHP?) in /var/www/html/enigma-dev.org/forums/Sources/Subs-Post.php on line 1332


But other than that, I have no indication of what might be going wrong. The messages are not removed from the queue as they are sent; instead, their timestamp is reset to the epoch. There is nothing in my forum's own error log about this, either.

Is there a way to try to send these emails from my command line? All I get when I attempt to do that is the string, "Hacking attempt." I imagine some error must be generated during this process, because otherwise, how does SMF know not to remove the email from the queue? Every time I look for how I might test sending mail in SMF, all I get is some telnet commands or a `mail` command. That doesn't test SMF's configuration... only my MTA.

Any help tracking this down would be greatly appreciated. Otherwise, I think I may have to configure my own MTA as a relay to Gmail.

Thanks in advance!

vbgamer45

If you do a phpinfo page check under "Registered Stream Socket Transports"
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Josh @ Dreamland

#2
Thanks for the quick reply! I get these:

tcp, udp, unix, udg, ssl, sslv3, sslv2, tls

I went ahead and tested with sslv2/v3; same result as plain ssl.
­

aegersz

The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Josh @ Dreamland

Well, I'll be. That indeed fixed it. I wonder why such a patch hasn't already been made, since that line seems to just check for support of EHLO... Anyway, thank you very much! Awesome to have email working. Once I edited that line, I got an email from Google letting me know some weird server was trying to use my account. I allowed access to "Less secure apps," and suddenly, everything worked perfectly.

Thanks again!

aegersz

mainly for educational purposes, i turned this tiny code change into a mod for my 2.0.14 system ... it works but it is obviously not sanctioned by Simple Machines ... BUT it does demonstrate how to build/package the most basic components of a mod (for any aspiring mod authors wondering where to start). Unlike me, i suggest that one learns php !

package-info.xml:

<?xml version="1.0"?>
<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">

<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
        <id>aegersz:smtpssl</id>
        <name>SMTP-SSL</name>
        <version>1.0</version>
        <type>modification</type>
        <install>
                <modification format="xml" type="file">install.xml</modification>
        </install>
        <uninstall>
                <modification reverse="true">install.xml</modification>
        </uninstall>
</package-info>


install.xml:

<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">

<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
        <id>aegersz:smtpssl</id>
        <version>1.0</version>
        <file name="$sourcedir/Subs-Post.php">
                <operation>
                        <search position="replace"><![CDATA[
                // EHLO could be understood to mean encrypted hello...
                if (server_parse('EHLO ' . $modSettings['smtp_host'], $socket, null) == '250')
]]></search>
                        <add><![CDATA[
                // EHLO could be understood to mean encrypted hello...
//              if (server_parse('EHLO ' . $modSettings['smtp_host'], $socket, null) == '250')
                if (server_parse('EHLO ' . 'localhost', $socket, null) == '250')
]]></add>
                </operation>
        </file>
</modification>
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Advertisement: