MailApp
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Gửi email đơn giản
function sendSimpleTextEmail(recipient, subject, body) {
MailApp.sendEmail(recipient, subject, body);
}
Gửi email có tệp đính kèm
function sendEmailWithAttachments() {
const fileId = '0B41tKrRQJmxeQXlsQUVkMzNxN28';
// Send an email with two attachments: a file from Google Drive (as a PDF)
// and an HTML file.
const file = DriveApp.getFileById(fileId);
const blob = Utilities.newBlob('Insert any HTML content here', 'text/html',
'my_document.html');
MailApp.sendEmail('RECIPIENT_EMAIL', 'Attachment example',
'Two files are attached.',
{
name: 'Automatic Emailer Script',
attachments: [file.getAs(MimeType.PDF), blob]
});
}
Gửi email HTML có hình ảnh
function sendHtmlEmailWithInlineImage() {
const googleLogoUrl =
'http://www.google.com/intl/en_com/images/srpr/logo3w.png';
const youtubeLogoUrl =
'https://developers.google.com/youtube/images/YouTube_logo_standard_white.png';
const googleLogoBlob = UrlFetchApp
.fetch(googleLogoUrl)
.getBlob()
.setName('googleLogoBlob');
const youtubeLogoBlob = UrlFetchApp
.fetch(youtubeLogoUrl)
.getBlob()
.setName('youtubeLogoBlob');
MailApp.sendEmail({
to: 'RECIPIENT_EMAIL',
subject: 'Logos',
htmlBody: "inline Google Logo<img src='cid:googleLogo'> images! <br>" +
"inline YouTube Logo <img src='cid:youtubeLogo'>",
inlineImages:
{
googleLogo: googleLogoBlob,
youtubeLogo: youtubeLogoBlob
}
});
}
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2024-09-11 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Thiếu thông tin tôi cần"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Quá phức tạp/quá nhiều bước"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Đã lỗi thời"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"Vấn đề về bản dịch"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Vấn đề về mẫu/mã"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Khác"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Dễ hiểu"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Giúp tôi giải quyết được vấn đề"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Khác"
}]
{"lastModified": "C\u1eadp nh\u1eadt l\u1ea7n g\u1ea7n \u0111\u00e2y nh\u1ea5t: 2024-09-11 UTC."}
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2024-09-11 UTC."]]