【发布时间】:2012-02-28 16:11:12
【问题描述】:
我正在使用 Ruby 通过 Google 应用程序发送电子邮件。正在发送和接收电子邮件。问题是该电子邮件在我的 Gmail 收件箱中显示为发送给未公开的收件人,并且没有主题。
require 'rubygems'
require "tlsmail"
message = <<MESSAGE_END
From: From Address <from.address@googleappsdomain.com>
To: My Address <my.address@mydomain.com>
Subject: The Subject
Date: #{Time.now.rfc2822}
This is the email body.
MESSAGE_END
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
Net::SMTP.start('smtp.gmail.com', 587, 'smtp.gmail.com', 'from.address@googleappsdomain.com', 'password', :login) do |smtp|
smtp.send_message(message, 'from.address@googleappsdomain.com', 'my.address@mydomain.com')
end
正如我所指出的,电子邮件已收到。标题看起来像:
发件人:发件人地址 收件人:我的地址 主题:主题日期:2012 年 2 月 28 日星期二 09:54:22 -0500 from.address@googleappsdomain.com 发件人时间:上午 9:54 (GMT-08:00) 发送。那里的当前时间:上午 7:45。 ✆ 至: 日期:2012 年 2 月 28 日星期二上午 9:54
主题不见了。
这不是什么大不了的事,但如果可能的话,我希望它像典型的电子邮件一样收到。
【问题讨论】: