2016-03-29 15 views
0

私はmailgunを通して送信している電子メールのテキストに<a>リンクを埋め込むようにしています。正しい構文は何ですか?mailgunに<a>タグが埋め込まれたプレーンテキストの電子メールを送信する

私はこれは私のメーラーがどのように見えるかです

に私はすべての私の電子メールにHTMLを送りたいあなたは1 を選択する必要がHTMLと「テキスト」のメールを送ることができると考えてはいけない

RestClient.post "https://api:#{ENV['MAILGUN_SECRET']}"\ 
    "@api.mailgun.net/v3/#{ENV['MAILGUN_DOMAIN']}/messages", 
    :from => "Mailgun <[email protected]#{ENV['MAILGUN_DOMAIN']}>", 
    :to => "#{@lead.email}", 
    :subject => "Test", 
    :text => "Here is the message, here(http://www.foo.com) is the link" 

答えて

0

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<[email protected]>", 
     :to => @lead.email, 
     :reply_to => 'Email Sender<[email protected]>', 
     :subject => "Test" 
    ) 
    end 
end 

これは今楽しい部分です。

Here is the message, here(<a href="http://www.foo.com"> foo.com </a>) is the link 

私は、これは

に役立つことを願っています:ようなあなたのHTMLが含ま email_method.html.erbと呼ばれ、そのディレクトリにファイルを作成するので、あなたが今 app/views/some_mailer

で終わるapp/viewsSomeMailerというフォルダを作成します。

関連する問題