send email using gmail-api and google-api-php-client

后端 未结 5 1361
感动是毒
感动是毒 2021-01-16 03:24

I am using https://github.com/google/google-api-php-client and I want to send a test email with a user\'s authorized gmail account.

This is what I have so far:

5条回答
  •  清酒与你
    2021-01-16 04:10

    Create the mail with phpmailer works fine for me in a local enviroment. On production I get this error:

    Invalid value for ByteString
    

    To solve this, remove the line:

    $mail->Encoding = 'base64';
    

    because the mail is two times encoded.

    Also, on other questions/issues I found the next:

    use

    strtr(base64_encode($val), '+/=', '-_*')
    

    instead of

    strtr(base64_encode($val), '+/=', '-_,')
    

提交回复
热议问题