• Resolved miturbe

    (@miturbe)


    Hello,
    This is my stack:
    WordPress: 5.4.1
    WordPress MS: No
    PHP: 7.3.14-1~deb10u1
    WP Mail SMTP: 2.0.0

    The problem that I have is that it is not sending the proper name in the EHLO command. Instead of sending domain.org, it is sending *.domain.org, which is being rejected by the SMTP server.

    How can I fix this? I did a search for *.domain.org at the database level, all tables, all columns and I did not find it. Is it something I can fix in the code?

    
    2020-06-26 21:16:17 CLIENT -> SERVER: EHLO *.domain.org
    
    2020-06-26 21:16:17 SERVER -> CLIENT: 501-5.5.4 HELO/EHLO argument "*.domain.org" invalid, closing connection.501 5.5.4 
    
    2020-06-26 21:16:17 SMTP ERROR: EHLO command failed: 501-5.5.4 HELO/EHLO argument "*.domain.org" invalid, closing connection.501 5.5.4 
    
Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter miturbe

    (@miturbe)

    Updated to version WP Mail SMTP: 2.1.1
    Problem persists.

    Thread Starter miturbe

    (@miturbe)

    SOLVED:
    Looking at the code, I saw that this application gets the hostname from the PHP SERVER_NAME variable, instead of getting it from WordPress values.
    So in the NGINX server File, the value was

    server_name *.domain.org;

    I changed this to:
    server_name domain.org *.domain.org;

    And this solved the issue

    • This reply was modified 4 years, 8 months ago by miturbe.

    Hi @miturbe,

    I’m glad you sorted it out and thanks for taking time to let us know.

    Have a good one!

    I have the same issue. However, my canonical domain name is https://www.example.com, so I cannot change the nginx settings.

    Is there a way to override the EHLO server name without modifying the server_name in nginx?

    • This reply was modified 4 years, 8 months ago by rocketraman.

    Looks like PHPMailer supports setting the $Helo configuration value: https://phpmailer.github.io/PHPMailer/classes/PHPMailer.PHPMailer.PHPMailer.html#property_Helo

    Plugin Author Gregor Capuder

    (@capuderg)

    Hi @rocketraman,

    please try adding the code below to your theme’s functions.php file and change the ‘test.com’ string to your domain:

    
    add_action( 'wp_mail_smtp_mailcatcher_smtp_pre_send_before', function( $mailcatcher ) {
    	$mailcatcher->Helo = 'test.com';
    } );
    

    If you don’t know how to add PHP code to your site, please try adding the code via
    a plugin, like described here.

    Let me know if this resolves your issue.

    Take care!

    Thanks Gregor. I found a different workaround/solution so this should now be unnecessary for me now, however for future searchers, I believe it should be wp_mail_smtp_mailcatcher_smtp_send_before (no pre), based on the code in src/MailCatcher.php.

    • This reply was modified 4 years, 8 months ago by rocketraman.
    Plugin Author Gregor Capuder

    (@capuderg)

    Hi @rocketraman,

    you are correct, thank you! I was testing in the current development code and we have a new action that I posted above.

    So for others that might have this issue and are on v2.1.1 or lower, please try adding this code to your WP site and change the ‘test.com’ to your domain:

    
    add_action( 'wp_mail_smtp_mailcatcher_smtp_send_before', function( $mailcatcher ) {
    	$mailcatcher->Helo = 'test.com';
    } );
    

    @rocketraman, could you please also share your solution to this problem? ?? It’s always better to have more possible solutions.

    Take care!

    My solution was in some ways the “obvious” one, which was to configure my SMTP server to accept the sent value.

    Plugin Author Gregor Capuder

    (@capuderg)

    Hi @rocketraman,

    thanks for sharing ??

    Have a nice day!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘EHLO protocol issue’ is closed to new replies.