Support » Plugin: WP Mail SMTP Plugin by Mail Bank » PHP to Send Mail

  • Resolved Lawrence Pepper

    (@lawrence-pepper)



    Hello,

    I have Mail Blank setup properly to send mail through our Office 365 account. It send the test mails out fine. But none of my emails from my PHP code is being sent.

    The code being used:

    // mail to
    $to = $superemail;

    // subject
    $subject = ‘Hours Submitted for Approval’;

    // message
    $message = ‘
    <html>
    <body>
    ‘ . $super . ‘,<br>
    <br>
    ‘ . $person . ‘ has requested you review his/her hours that have been submitted for approval in the time sheets application.
    <br><br>
    <b>Comments:</b><br>
    ‘ . $comment . ‘<br>
    <br>
    Please follow this link to approve all submitted hours for ‘ . $person . ‘:<br>
    <br>
    Approve Hours
    <br><br>
    Thanks,
    <br><br>
    <b>Your Friendly Neighborhood Time Sheets Program</b>

    </body>
    </html>
    ‘;

    // To send HTML mail, the Content-type header must be set
    $headers = ‘MIME-Version: 1.0’ . “\r\n”;
    $headers .= ‘Content-type: text/html; charset=iso-8859-1’ . “\r\n”;

    // Additional headers
    $headers .= ‘From: ‘ . $person . ‘ <‘ . $useremail . ‘>’ . “\r\n”;

    // Mail it

    mail($to, $subject, $message, $headers);`

    What am I doing wrong? Thank you for any help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Varun Sharma

    (@contact-banker)

    Hi,

    We only support wp_mail function and override it with our custom settings.

    So, we recommend it using the wp_mail function instead of mail function, so Mail Bank can bypass it and use the SMTP Settings to send emails.

    Thanks

    Hello – I tried using the wp_mail function and it does not work. Your test email never gets sent.

    I get the following:

    2018-05-29 12:46:35 Could not instantiate mail function.
    Your Web Host provider may have blocked the use of mail() function on your server.
    Ask them to enable the mail() function to start sending emails.

    When I use the mail function it does get sent but my code above does not work.

    Message when testing using SMTP Option:

    Checking your settings
    Sending Test Email to lpepper@xxxxxxxxx
    Email Status : Email Sent
    —————————————————————————————-
    Debug Output :
    —————————————————————————————-
    220 BN4PR12CA0011.outlook.office365.com Microsoft ESMTP MAIL Service ready at Tue, 29 May 2018 12:48:28 +0000
    EHLO localhost
    250-BN4PR12CA0011.outlook.office365.com Hello [96.245.114.250]
    250-SIZE 157286400
    250-PIPELINING
    250-DSN
    250-ENHANCEDSTATUSCODES
    250-STARTTLS
    250-8BITMIME
    250-BINARYMIME
    250-CHUNKING
    250 SMTPUTF8
    STARTTLS
    220 2.0.0 SMTP server ready
    EHLO localhost
    250-BN4PR12CA0011.outlook.office365.com Hello [96.245.114.250]
    250-SIZE 157286400
    250-PIPELINING
    250-DSN
    250-ENHANCEDSTATUSCODES
    250-AUTH LOGIN XOAUTH2
    250-8BITMIME
    250-BINARYMIME
    250-CHUNKING
    250 SMTPUTF8
    AUTH LOGIN
    334 VXNlcm5hbWU6
    bHBlcHBlckBnZW4tdGVjaG5vLmNvbQ==
    334 UGFzc3dvcmQ6
    TWVsbG9uMjAxNg==
    235 2.7.0 Authentication successful target host SN1PR20MB2192.namprd20.prod.outlook.com
    MAIL FROM:<lpepper@xxxxxxxx>
    250 2.1.0 Sender OK
    RCPT TO:<lpepper@xxxxxxxx>
    250 2.1.5 Recipient OK
    DATA
    354 Start mail input; end with <CRLF>.<CRLF>
    To: lpepper@xxxxxx
    From: lpepper@gxxxxxxxxx
    Subject: Test Email – Mail Bank
    X-Mailer: Mail Bank SMTP 3.0.61 for WordPress (https://wordpress.org/plugins/wp-mail-bank/)
    Content-Type: text/html; charset=utf-8
    Date: Tue, 29 May 2018 12:48:29 +0000
    Content-Transfer-Encoding: quoted-printable
    Content-Disposition: inline
    MIME-Version: 1.0

    This is a demo Test Email for Email Setup – Mail Bank
    .
    250 2.6.0 <SN1PR20MB2192CF4B1828AC9AAEA8F6DA816D0@SN1PR20MB2192.namprd20.prod.outlook.com> [InternalId=8963596752490, Hostname=SN1PR20MB2192.namprd20.prod.outlook.com] 3325 bytes in 0.294, 11.029 KB/sec Queued mail for delivery

    Yet my code does not work above…..

    Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.