Method: Mailer#send
- Defined in:
- lib/mailer.rb
#send(to, md_file, subject, silent = false) ⇒ Object
发送邮件
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/mailer.rb', line 205 def send(to, md_file, subject, silent = false) article = self.get_article md_file from = self.get_from to = self.get_to to, article subject = self.get_subject subject, article relative_path = @util.get_relative_path article['file'], @util.workbench #配置邮件信息 self.set_mail_defaults #警示用户是否需要发送 self.alarm relative_path, subject, to if not silent #创建一个mail的实例,以后再添加附件和html内容 mail = Mail.new do from from to to subject subject end self.add_content mail, article # @util.write_file './send.log', mail.parts.last.decoded mail.deliver puts "恭喜,您的邮件发送成功" puts "邮件标题:#{subject}" puts "Markdown:#{relative_path}" puts "收件人:#{to}" end |