发送邮件 传递参数到正文
参考:https://guides.rubyonrails.org/action_mailer_basics.html


user_mailer.rb :
class UserMailer < ApplicationMailer
2 default from: ' web3@163.com'
3
4 def send_validation_email to, code, subject
5 @code = code
6 mail to: to, subject: subject
7 end
8
9 end正文:app/views/user_mailer/send_validation_email.html.erb
<body style="font-size:14px;font-family:arial,verdana,sans-serif;line-height:1.666;padding:0;margin:0;overflow:auto;white-space:normal;word-wrap:break-word;min-height:100px;
<table width="700" border="0" align="center" cellspacing="0" style="width:700px;">
<tbody>
<tr>
<td>
<div style="width:700px;margin:0 auto;border-bottom:1px solid #ccc;margin-bottom:30px;">
<table border="0" cellpadding="0" cellspacing="0" width="700" height="39" style="font:12px Tahoma, Arial, 宋体;">
<tbody><tr><td width="210"></td></tr></tbody>
</table>
</div>
<div style="width:680px;padding:0 10px;margin:0 auto;">
<div style="line-height:1.5;font-size:14px;margin-bottom:25px;color:#4d4d4d;">
<strong style="display:block;margin-bottom:15px;">尊敬的用户:<span style="color:#f60;font-size: 16px;"></span>您好!</strong>
<strong style="display:block;margin-bottom:15px;">
【ParaState】
验证码:<span style="color:#f60;font-size: 24px"><%= @code %></span>,该验证码将于15分钟后失效。
</strong>
</div>
</div>
<div style="margin-bottom:30px;">
<p style="color:#747474;">
</p >
</div>
<div style="margin-bottom:30px;">
<p style="color:#747474;font-size:14px;">
(工作人员不会向你索取此验证码,请勿泄漏!)
</p >
</div>
<div style="width:700px;margin:0 auto;">
<div style="padding:10px 10px 0;border-top:1px solid #ccc;color:#747474;margin-bottom:20px;line-height:1.3em;font-size:12px;">
<p>此为通知邮件,请勿回复<p>
<p>ParaState团队</p >
</div>
</div>
</td>
</tr>
</tbody>
</table>
</body>