我是 Pony 的新手。在我的 sinatra 应用程序中,我使用 Pony 发送邮件。但是我在发送多个 csv 文件作为附件时面临的问题。在邮件中,我只收到一个文件 noname.csv ,其中包含所有文件的内容。但我不想要它,我想要所有文件单独附加。我编写的代码如下:
def send_mail(file1, file2) do
Pony.mail(
:from => "mailer@abc.com",
:to => "joy@abc.com",
:subject => "text",
:content_type => "text/csv",
:via => :smtp,
:via_options => {
:address => "abc.com",
:port => 587,
:user_name => "test",
:password => "test123",
:authentication => plain ,
:domain => "abc.com",
:enable_starttls_auto => true},
:attachments => {"a.csv" => File.read("#{settings.root}"+"/"+"#{file1}"),"b.csv"=>File.read("#{settings.root}"+"/"+"#{file2}")}
end