• I’m currently having trouble with the Post SMTP plugin on WordPress in combination with Office 365. We’re using the smtp.office365.com settings (and we have verified that the account details we have are correct and allow login to the Office 365 account), and each test email we try to send comes with the following error:

    '' does not match the expected structure for a DNS hostname, '' does not appear to be a valid URI hostname, '' does not appear to be a valid local network name

    We have tried configuring this for port 587 and for port 25.

    HostName: 
    OS: Linux london-drainage 4.4.0-78-generic #99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017 x86_64
    PHP: Linux 7.0.13-0ubuntu0.16.04.1 en_US.UTF-8
    PHP Dependencies: iconv=Yes, spl_autoload=Yes, openssl=Yes, sockets=Yes, allow_url_fopen=Yes, mcrypt=Yes, zlib_encode=Yes
    WordPress: 4.9.8 en_US UTF-8
    WordPress Theme: X – Child Theme
    WordPress Plugins: 404page - your smart custom 404 error page, Contact Form 7 Google Analytics Integration, Contact Form 7 Modules: Hidden Fields, Contact Form 7, Cornerstone, Duplicator, Flamingo, Google Analytics for WordPress by MonsterInsights, Attercopia London Drainage Search, Page/Post Content Shortcode, Post SMTP, Redirection, Simple Custom CSS, UberMenu 3 - The Ultimate WordPress Mega Menu, UpdraftPlus - Backup/Restore, WonderPlugin Tabs, Yoast SEO, WP Fastest Cache, Smush, Contact Form 7 Redirection
    WordPress wp_mail Filter(s): wp_staticize_emoji_for_email
    WordPress phpmailer_init Action(s): wpcf7_phpmailer_init
    Postman: 1.9.4
    Postman Sender Domain (Envelope|Message): london-drainage.co.uk | london-drainage.co.uk
    Postman Prevent Message Sender Override (Email|Name): No | No
    Postman Active Transport: SMTP (smtp:tls:login://smtp.office365.com:25)
    Postman Active Transport Status (Ready|Connected): Yes | Yes
    Postman Deliveries (Success|Fail): 0 | 0

    Any suggestions or recommendations would be very helpful.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 16 through 19 (of 19 total)
  • Thread Starter csreid

    (@csreid)

    That one’s still showing as blank when it’s loaded, with no visible error messages.

    Again, and update me if now you see an input starting with: string…..

    
    <?php
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
    
    echo getServerName(); 
    
    function getServerName() {
    $result = 'localhost.localdomain';
    
    if (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER)) {
        $result = $_SERVER['SERVER_NAME'];
    } elseif (function_exists('gethostname') and gethostname() !== false) {
        $result = gethostname();
    } elseif (php_uname('n') !== false) {
        $result = php_uname('n');
    }
    
    var_dump( $result );
    
            if ( $result !== 'localhost.localdomain' ) {
                    // get the current result ip
                    $ip = gethostbyname($result);
    
                    // dns query failed
                    if ( $ip == $result ) {
                            return $result;
                    }
    
                    // get the current ip hostname - reverse dns
                    $host = gethostbyaddr($ip);
    
                    // dns query failed
                    if ( $host == $ip || $host == false ) {
                            return $result;
                    }
    
                    // if hostname is not equal to the result set the ptr
                    if ( $result !== $host ) {
                            $result = $host;
                    }
    
                    var_dump( $result );
    
            }
    
           return $result;
    }
    
    
    Thread Starter csreid

    (@csreid)

    Now I’m seeing a string(0) “” when running that file.

    Very strange,
    I have tested the script under nginx and it’s working.

    Contact me:
    https://postmansmtp.com/contact

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Post SMTP – Office 365 connection issue’ is closed to new replies.