Gメールに返信する機能を作っています。
下記のメソッド内で、message['bcc']をフィールドとして用意したのですが、テストしてもBcc枠に入れたメールアドレスが表示されてしまいます。
Bccを使ってメールを送信する方法はあるのでしょうか?
python
def create_message(self, sender, to, thread_id, cc=None, bcc=None, subject=None, message_text=None, attachments=None): message = MIMEMultipart() message['from'] = sender message['to'] = to message['cc'] = cc message['bcc'] = bcc message['subject'] = subject msg = MIMEText(message_text) message.attach(msg) if attachments is not None: app = Attachments() for attachment in attachments: path = app.copy(attachment) with open(path, "rb") as f: part = MIMEApplication(f.read(), Name=basename(path)) part['Content-Disposition'] = 'attachment; filename="%s"' % basename(path) message.attach(part) raw_msg = base64.urlsafe_b64encode(message.as_bytes()).decode() raw_msg = {'raw': raw_msg, 'threadId': thread_id} return raw_msg
##Bccに2件アドレスを設定して送った時
Gmailの受信結果を見ると次のようにBccで誰に送っているのか分かる仕様になってます。
まだ回答がついていません
会員登録して回答してみよう