構造「スレッド」と「メッセージ」
- メッセージ:いわゆるメールの単位
- スレッド:ある一つのメッセージに対する返信を束ねる
Mail
メールを送る
GmailApp.sendEmail(recipient, subject, body)
GmailApp.sendEmail(recipient, subject, body, options)
GoogleDriveのファイルを添付する
optionsに
{attachmens : BlobSourse[]}
を指定
sendmailのサンプルを見てみると
var file = DriveApp.getFileById('1234567890abcdefghijklmnopqrstuvwxyz');
GmailApp.sendEmail('
mike@example.com', 'Attachment example', 'Please see the attached file.', {attachments: [file.getAs(MimeType.PDF)], name: 'Automatic Emailer Script'});
とある。
BlobSourceを見てみると、そのなかに 「File : A file in Google Drive」 が存在。つまり、添付するファイルのオブジェクトを取得して、これを
{attachments: (File)}
(BlobSource).getAs(contentType)
(BlobSource).getBlob()
getAs(contentType)で、多くの場合に使えるのは 'application/pdf'
画像系なら 'image/bmp', 'image/gif', 'image/jpeg', or 'image/png'
が使える
上記のサンプルの中では、file.getAs(...) としているが、この関数でBlobが返っている。
メールを検索する
GmailApp.search(queryString)
メールの受信(送信)日時を取得する
メールを削除する(ゴミ箱行き)
最終更新:2015年06月11日 00:02