I am trying to embed an <a>
link within the text of an email I'm sending through mailgun. What is the correct syntax?
RestClient.post "https://api:#{ENV['MAILGUN_SECRET']}"\
"@api.mailgun.net/v3/#{ENV['MAILGUN_DOMAIN']}/messages",
:from => "Mailgun <mailgun@#{ENV['MAILGUN_DOMAIN']}>",
:to => "#{@lead.email}",
:subject => "Test",
:text => "Here is the message, here(http://www.foo.com) is the link"
答案 0 :(得分:0)
我不认为你可以发送&#34;文本&#34;使用HTML发送电子邮件,您必须选择一个 我喜欢发送所有电子邮件HTML
这就是我的邮件的样子:
class SomeMailer < ActionMailer::Base
def email_method(post_id, lead_id)
@post = Post.find(post_id)
@lead = Lead.find(lead_id)
mail(
:from => "Email Sender<info@example.com>",
:to => @lead.email,
:reply_to => 'Email Sender<info@example.com>',
:subject => "Test"
)
end
end
现在这是有趣的部分。在SomeMailer
中创建一个名为app/views
的文件夹,以便最终得到app/views/some_mailer
现在在名为email_method.html.erb
的目录中创建一个包含html的文件:
Here is the message, here(<a href="http://www.foo.com"> foo.com </a>) is the link
我希望这有助于