actionmailer

Problem sending multipart mail using ActionMailer

淺唱寂寞╮ 提交于 2019-11-27 00:38:10
问题 I'm using the following code to send emails in rails: class InvoiceMailer < ActionMailer::Base def invoice(invoice) from CONFIG[:email] recipients invoice.email subject "Bevestiging Inschrijving #{invoice.course.name}" content_type "multipart/alternative" part "text/html" do |p| p.body = render_message 'invoice_html', :invoice => invoice end part "text/plain" do |p| p.body = render_message 'invoice_plain', :invoice => invoice end pdf = Prawn::Document.new(:page_size => 'A4') PDFRenderer

Contact Form Mailer in Rails 4

与世无争的帅哥 提交于 2019-11-27 00:30:18
问题 I am trying to build a contact form in Rails 4, where the form takes a name, email, and body and sends it to my email address. Upon clicking "Submit", the app redirects back to the Contact page correctly, but no email appears to get sent. routes.rb match '/send_mail', to: 'contact#send_mail', via: 'post' contact_email.html.erb <!DOCTYPE html> <html> <head> <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> <%= javascript_include_tag "application", "data

ActionMailer 3 without Rails

前提是你 提交于 2019-11-27 00:28:59
问题 I'm writing a small Ruby program that will pull records from a database and send an HTML email daily. I'm attempting to use ActionMailer 3.0.3 for this, but I'm running in to issues. All the searching I've done so far on using ActionMailer outside of Rails applies to versions prior to version 3. Could someone point me in the right direction of where to find resources on how to do this? Here's where I am so far on my mailer file: # lib/bug_mailer.rb require 'action_mailer' ActionMailer::Base

Errno::ECONNREFUSED: Connection refused - connect(2) for action mailer

这一生的挚爱 提交于 2019-11-26 23:05:51
问题 I have been working with rails since a long. Now I am facing a small issue in the ActionMailer. I want to send an email when user gets registered to confirm his registration. I am able to send email in the development mode but where as not in the production mode. the exception Errno::ECONNREFUSED: Connection refused - connect(2) is coming everytime when deliver method is called. I have written the following code. My SMTP config looks: config.action_mailer.default_url_options = { :host =>

Actionmailer not working when I change gmail password

谁说我不能喝 提交于 2019-11-26 22:02:38
问题 I have a Rails app that uses Gmail to send Actionmailer emails. It has been working great for months, but now that I changed my Gmail password it has stopped working and I get an error: Net::SMTPAuthenticationError (535-5.7.8 Username and Password not accepted. I've adjusted the new password in my production.rb and development.rb files: config.action_mailer.smtp_settings = { address: 'smtp.gmail.com', port: 587, #domain: 'thetens.us', user_name: 'myaddress@gmail.com', password: 'mypassword',

Heroku/devise - Missing host to link to! Please provide :host parameter or set default_url_options[:host]

≯℡__Kan透↙ 提交于 2019-11-26 21:26:14
I am trying to push my app on heroku. I am still in dev. I use devise with the confirmable module. When I try to add a user with the heroku console I got this error: Missing host to link to! Please provide :host parameter or set default_url_options[:host] in test and dev environment i have the following line: environments/development.rb and environments/test.rb config.action_mailer.default_url_options = { :host => 'localhost:3000' } I don't have set up something in the production environment. I've tried to push with config.action_mailer.default_url_options = { :host => 'mywebsitename.com' }

How to send emails with multiple, dynamic smtp using Actionmailer/Ruby on Rails

末鹿安然 提交于 2019-11-26 19:20:36
问题 I saw this post but mine is slightly different: Rails ActionMailer with multiple SMTP servers I am allowing the users to send mail using their own SMTP credentials so it actually does come from them. But they will be sent from the Rails app, so that means for each user I need to send their emails using their own SMTP server. How can I do that? 回答1: Just set the ActionMailer::Base configuration values before each send action. smtp_config = user.smtp_configuration ActionMailer::Base.username =

How do I create a Mailer Observer

这一生的挚爱 提交于 2019-11-26 19:14:45
问题 I'd like to run some code whenever an email is sent on my app. As ActionMailer doesn't support after_filter, I would like to use an observer. The Rails docs mention this in passing, however does not elaborate. Thanks! 回答1: I'm surprised how little there is in Rails' documentation about this. Basically, ActionMailer in Rails 3 introduces the use of Interceptors (called before the message is sent) and Observers (after the message is sent). To set up an Observer, add the following to an

Rails ActionMailer - format sender and recipient name/email address

删除回忆录丶 提交于 2019-11-26 18:54:42
问题 Is there a way to specify email AND name for sender and recipient info when using ActionMailer? Typically you'd do: @recipients = "#{user.email}" @from = "info@mycompany.com" @subject = "Hi" @content_type = "text/html" But, I want to specify name as well-- MyCompany <info@mycompany.com> , John Doe <john.doe@mycompany> . Is there a way to do that? 回答1: If you are taking user input for name and email, then unless you very carefully validate or escape the name and email, you can end up with an

Sending mail with Rails 3 in development environment

杀马特。学长 韩版系。学妹 提交于 2019-11-26 18:48:24
问题 I'm sure this has been asked a million times before but I can't find anything that works for me so I'm asking again! I just need a way of sending emails using ActionMailer in rails 3. I have followed numerous tutorials including the Railscasts tutorial on the new ActionMailer and I can see the mails being generated but I don't receive them. I have tried a bunch of different ways but they generally amount to configuring the following settings ActionMailer::Base.delivery_method = :smtp