簡體   English   中英

使用 google javascript API 發送電子郵件退回

[英]Sending email using google javascript API bounces

我正在嘗試使用 JS google API 發送電子郵件。 初始化進行得很順利,但是當我嘗試發送電子郵件時,它會退回說“發生錯誤。您的消息未發送”而沒有任何其他數據。

我發送測試電子郵件的代碼:

let email = 'To:luoruize@gmail.com\r\n';
email += 'Subject:Testing\r\n';
email += 'This is a test!';

const message = window.btoa(email).replace(/\+/g, '-').replace(/\//g, '_');

gapi.client.gmail.users.messages.send({
    userId: 'me',
    resource: {
        raw: message
    }
}).execute((res) => {
    console.log(res);
});

我究竟做錯了什么?

原來問題是在內容之前必須有一個額外的\\r\\n...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM