我正在尝试在 Sinatra 中编写简单的邮件程序,它发送带有参数变量的电子邮件。
require 'sinatra'
require 'mail'
class App < Sinatra::Base
post '/test_mailer' do
company = params['Field6']
email = params['Field5']
puts "Company name: #{company}"
puts "Email: #{email}"
mail = Mail.new do
from 'me@mydomain.com'
to 'me@mydomain.com'
subject 'Here is the image you wanted'
text_part do
body "Company Name \n === \n #{company} \n \n Email \n === \n #{email}"
end
end
mail.deliver!
end
end
如何使用公司和电子邮件变量将电子邮件模板移动到 test_mailer.txt?