Send HTML emails with inline images with ActionMailer
-
I have a simple ActionMailer class like this: class MyMailer < ActionMailer::Base def mail(from, to, cc, bcc, subject, message, sent_at = Time.now) @subject = subject @recipients = to @from = from @cc = cc @bcc = bcc @sent_on = sent_at @body["message"] = message @headers = {} end end And I ue it like this from a controller: MyMailer.deliver_mail(mail.from, mail.to, mail.cc, mail.bcc, mail.subject, mail.message) I prefer to keep it simple with no templates or such, and it is a webservice with no views. How do I change it to be able to send HTML mails with embedded images (in img tags i mean)? I need to attach the images woth the correct mime-type and also set the body with the correct mime-type, but how? Thank you
-
Answer:
Neigaard at Stack Overflow Visit the source
Related Q & A:
- How to send mass emails?Best solution by Server Fault
- Can't send AOL emails?Best solution by Yahoo! Answers
- How to send multiple emails in Yahoo?Best solution by in.answers.yahoo.com
- When you block someone from your messenger can they still send you emails?Best solution by Yahoo! Answers
- How do you send bulk emails?Best solution by eHow old
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.