Rails Action Mailer Document

Created: 2019/10/01

 

set up
 Action Mailer setting parameters

 

 delivery_method

 The method of sending mail

 ● Default:: smtp

 ● value can be set

 

 :smtp  Sends the smtp server
 :sendmail  With sendmail command
 :file  The e-mail as a file
 :test

 Test Mode

 (The message was returned as an array)

 

 default_options  The default mail header
 interceptors  interceptor applications
 perform_deliveries

 Whether the delivery method actually sending mail

 ● Default: true

 raise_delivery_errors

 Mail is thrown error when sending failure

 ● Default: true

 show_previews

 mail preview function is valid

 ● Default: development environment true

           test / product environment false

 smtp_settings

 Mode setting in smtp 

 address

 Smtp server hostname

 Default localhost

 port

 smtp server port

 Default: 25

 domain

 HELO domain

 Default: localhost.localdomain

 user_name  username
 password  password 
 authentication

 Authentication method

 :plain, :login, :cram_md5

 

 sendmail_settings

 Mode setting in sendmail

 location

 Position command

 Default: / usr / bin / sendmail

 arguments

 Options sendmail command

 Default: -i -t

 

 file_settings

 Set in the file mode

 location

 Storage Location

 Default: # {Rails.root} / tmp / mails

   

 

   

 

   
send email
 Generating mailer  
rails generate mailer name method [options]

 

 name  mailer name
 method  方法名
 options

 

 -f --force  已经存在的文件则覆盖
 -p --pretend  不生成文件,只是测试运行结果
 -q --quiet  不显示过程(进度)
 -s --skip  存在同名文件则跳过该文件

 

 

   
   
   
   
多种格式发送邮件
   
   
   
   
   
preview邮件
   
   
   
   
   
发送前进行处理
   
   
   
   
   
mailer的unit test
   
   
   
   
   

Guess you like

Origin www.cnblogs.com/lancgg/p/11614799.html