html 邮件 附件,HTML电子邮件缺少附件

当我使用Ruby 1.92发送HTML电子邮件时,附件不会在某些电子邮件客户端中显示。附件应该是一个pdf文件。我可以在交换服务器上看到Outlook 2010中的附件,但不能在雅虎网络邮件中看到。HTML电子邮件缺少附件

如果我只是禁用HTML正文一切正常。

下面是代码:

require 'mail'

body_text = File.read('body.html')

subject_text = File.read("subject.txt")

Mail.defaults do

delivery_method :smtp, { :address => "servername", :port => "25", :user_name => "name", :password => "password", :authentication => 'login'}

end

message = Mail.new do

from ARGV[0]

to ARGV[1]

subject subject_text

# if I comment out this section everything works fine

html_part do

content_type 'text/html; charset=UTF-8'

body body_text

end

add_file ARGV[2]

end

message.deliver!

这里是HTML来源:

Hello,

This email was sent from Geiger and contains your A/R aged report for date. For any questions please call the Geiger helpdesk @ 207-755-2510

Technical Details:

     Sent from: Server_Name

     Sent To: rep_id

     Original Email: to_email

Helpdesk Please forward all enquiries to so and so

logo.gif

这里是message.to_s的输出:

Date: Tue, 22 Nov 2011 08:22:52 -0500

From: [email protected]

To: [email protected]

Message-ID: <4ecba22c9ecb[email protected]>

Subject: Your report for November, 2011 - consoto Gets it!

Mime-Version: 1.0

Content-Type: multipart/alternative;

boundary="--==_mimepart_4ecba22c550e5_1cec974ab416812";

charset=UTF-8

Content-Transfer-Encoding: 7bit

----==_mimepart_4ecba22c550e5_1cec974ab416812

Date: Tue, 22 Nov 2011 08:22:52 -0500

Mime-Version: 1.0

Content-Type: text/plain;

charset=UTF-8;

filename=test_attatchment.txt

Content-Transfer-Encoding: 7bit

Content-Disposition: attachment;

filename=test_attatchment.txt

Content-ID:

This is a test

----==_mimepart_4ecba22c550e5_1cec974ab416812

Date: Tue, 22 Nov 2011 08:22:52 -0500

Mime-Version: 1.0

Content-Type: text/html;

charset=UTF-8

Content-Transfer-Encoding: 7bit

Content-ID:

Hello,

This email was sent from consoto and contains your report for Nov 2011. For any questions please call the consoto helpdesk @ 207-755-2510

Technical Details:

     Sent from: GBFA100016

     Sent To: BDB

     Original Email: [email protected]

Helpdesk Please forward all enquiries to Wesley Staples or Shawn White

logo.gif

----==_mimepart_4ecba22c550e5_1cec974ab416812--

+0

这可能是一些客户端删除它为垃圾邮件?这是什么邮件库?也许问题应该针对该图书馆的联系信息? –

+0

在确实看到消息正确的客户端上,您能查看原始源代码(包括头文件)并发布完整的原始消息吗? –

+0

如果您使用的是https://github.com/mikel/mail,则发布'message.to_s'的输出(使用小的txt文件而不是pdf) –

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值