电子邮件附件 [英] Email attachments

查看:57
本文介绍了电子邮件附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够附加我生成的文件(即时,我不想将文件保存在我的服务器上)并通过电子邮件发送出去.

I want to be able to attach a file that I generate (on the fly, I dont want to save the file on my server) and send it out via email.

我已经完成了所有文本,但我不知道如何使用 sendmail 将文件附加到电子邮件

I have the text all done, but I'm lost on how to attach the file to the email using sendmail

谢谢

推荐答案

参见 http://railscasts.com/episodes/206-action-mailer-in-rails-3

def registration_confirmation(user)
  @user = user
  attachments["rails.png"] = File.read("#{Rails.root}/public/images/rails.png")
  mail(:to => "#{user.name} <#{user.email}>", :subject => "Registered")
end

这篇关于电子邮件附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆