actionmailer

Rails 3 Action Mailer uninitialized constant

人走茶凉 提交于 2019-12-10 14:56:03
问题 I'm trying to use actionmailer to notify me when a new comment has been posted but I keep getting the error: uninitialized constant CommentsController::CommentMailer The comment is added to my database and can be viewed. I am also using devise and it's email functions are working fine. My comment mailer: class CommentMailer < ActionMailer::Base def newcomment(comment) mail(:to => "admin@example.com", :subject => "New Comment") end end and my controller section: def create @comment = Comment

Rails ActionMailer encoding

一曲冷凌霜 提交于 2019-12-10 14:54:45
问题 Setup: Ruby 1.9.2 Rails 3.2.2 I'm having some trouble with the encoding of my emails. Note: I'm not that familiar with encoding and stuff like that. When sending an email with ActionMailer, something weird is going on with the html in the email. All equal(=) signs are getting changed to =3D . Example: <table border=3D"0" cellpadding=3D"0" cellspacing=3D"0" width=3D"=440"> <tbody> <tr> <td height=3D"10"> </td> </tr> </tbody> </table> Special characters looks like this: ä -> ä . It looks great

How to serialize and deserialise mailers?

南楼画角 提交于 2019-12-10 14:48:42
问题 How can I serialise the mailer so that it can be stored for further use? The serialised data should be disconnected and self sufficient to be delivered on separate machine that should deliver that message (not knowing about database or anything else). 回答1: Suppose you usually send emails with this: MyMailer.some_email(...).deliver Instead delivering it, you can convert it to a string and transfer the string to another server: raw_mail = MyMailer.some_email(...).to_s On another server, send

removing 'via sendgrid.me' from mail sent using on heroku

两盒软妹~` 提交于 2019-12-10 09:24:02
问题 I'm using the free sendgrid plan to send email from my rails app hosted on heroku. I set it up using a combination of these instructions and this tutorial It's all working, but on gmail the it the sender comes through as 'myemail@myapp.com via sendgrid.me' Is there any way to get rid of this? I've had a look at this forum but it's not very clear on whether it's possible. If I can't remove it, can anyone recommend an alternative, free, service? 回答1: I know its an old question. But things are

How do I send signed emails from ActionMailer in Rails 3?

主宰稳场 提交于 2019-12-10 01:14:27
问题 Using Rails 3 I want to use an X.509 certificate to sign parts of emails. There is a currently existing answer for Rails 2 at How do I send signed emails from ActionMailer? but it doesn't work on Rails 3. Is it possible to sign emails via ActionMailer in Rails 3? If that is not possible, is it possible to sign emails via sendmail after creating by ActionMailer? 回答1: perhaps it's not the best answer, however here's what I'd do: try to install that plugin (even if it's for rails 2.0.x) tests

Rails 3 mailer not working and not logging any errors

笑着哭i 提交于 2019-12-09 15:16:10
问题 I have tried all kinds of configurations but still I can't send an email in my development environment from rails. I installed mailutils to try this from the command line and it worked, I received the email (in spam of course): echo test | mail -s Subject user@example.com Here's my config: # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = true # still no logs about emails config.action_mailer.delivery_method = :smtp config.action_mailer.perform_deliveries =

ArgumentError: An SMTP To address is required to send a message. Set the message smtp_envelope_to, to , cc, or bcc address

北城余情 提交于 2019-12-09 07:44:39
问题 I got an rails 4 application with following mailer configuration: config.action_mailer.delivery_method = :smtp config.action_mailer.default_url_options = { host: 'myhost.com' } config.action_mailer.perform_deliveries = true config.action_mailer.smtp_settings = { :enable_starttls_auto => true, :address => 'smtp.myhost.com', :port => 587, :domain => 'myhost.com', :authentication => :login, :enable_starttls_auto => false, :tls => false, :openssl_verify_mode => 'none', :ssl => false, :user_name =

Actionmailer SMTP Server Response

北战南征 提交于 2019-12-09 03:09:34
问题 When sending mail through actionmailer, the actionmailer gets a response from the SMTP server, when its ok, or when its wrong. Is there a way to retrieve this response after sending a mail? Also when no errors are thrown by the SMTP server? Our qmail mail server throws a handler id which we want to use for tracing e-mails. As an example, the server response is this : 250 ok 1308235825 qp 17832 回答1: Set return_response: true in the smtp settings and call message.deliver! instead of deliver .

Trouble adding a file stored on S3 through Paperclip as an attachment in ActionMailer

只愿长相守 提交于 2019-12-08 16:18:25
问题 I'm using Paperclip and S3 for file upload and storage in a Rails 3 app. The uploading of the files is working well, but when trying to attach an uploaded file to an email message with actionmailer, I am running into issues. After a lot of troubleshooting, hopefully someone can offer a hint. From a high level, it seems like I may need to download the file first, with some kind of download method before attaching, which is suggested here but I do not quite follow on how to implement -

How to get the name of the action in an after_action filter for ActionMailer

≡放荡痞女 提交于 2019-12-08 15:38:13
问题 In the class below, how do I get the current action name (i.e. email_confirmation , password_reset ) in side the after_action callback add_mandril_headers ? class UserMailer < ActionMailer::Base after_action :add_mandril_headers def email_confirmation(user) mail(..) end def password_reset(user) mail(..) end private # how to get the action name? def add_mandrill_headers headers['X-MC-Tags'] = [mailer_name, action_name].join('_'); end end 回答1: Turns out action_name returns the current mailer