开发者

TMail Object Missing BCC Information

开发者 https://www.devze.com 2022-12-10 20:24 出处:网络
I a开发者_如何学Gom running a cron job that checks for new email on a Gmail account every minute.If any new mail is found, it triggers a receive function that begins as follows:

I a开发者_如何学Gom running a cron job that checks for new email on a Gmail account every minute. If any new mail is found, it triggers a receive function that begins as follows:

  def receive(email)     
    # REPORT SOME INFORMATION ABOUT INBOUND EMAIL RECEIPT
    puts "SUBJECT: #{email.subject}" 
    puts "#{email.class}"
    puts email.to.inspect
    puts email.bcc.inspect
    puts email.from.inspect
    ...
  end

I would like to process only email that addresses the system in the TO or BCC fields. The idea is that users should not disclose the various destination email addresses to others.

The problem is that this function cannot seem to pull BCC information from the TMail object that is passed as the "email" parameter to this object. TO addresses come through fine, but not BCCs.

Anyone know why this might be the case?


TL;DR version: As an email client, you cannot reliably retrieve the BCC field.

Of course it's missing the BCC field. Once used to direct an email it's removed from the message.

BCC means Blind Carbon Copy. And is used to copy people on messages without giving their addresses out to every one else receiving the message. If the incoming email still had this information it wouldn't serve it's purpose.

You should probably read the section RFC 2822 about addressing.

What you're asking about isn't explicitly defined and becoming implementation dependent. The Mail User Agent (Outlook/Thunderbird/Gmail/etc) or the Mail Transport/Submission Agents (any program that routes the message to you) could be stripping the data you want before you get it.

0

精彩评论

暂无评论...
验证码 换一张
取 消