Contact form & Sendgrid - How to build a blog & portfolio with Rails 4

Mackenzie Child · 18K views · 2015 · 16:53

Open on YouTube

Web developmentPython, Ruby & scripting languagestutorialdated

Why Stack Overflow recommends it

Stack Overflow users cite it as the tutorial they followed when setting up a Rails contact form with mail_form and SendGrid, usually when their version of it breaks.

Recommended by 1 people across 1 different months, 2015 to 2020.

What it is

A 17-minute Rails 4 tutorial from Mackenzie Child, part of a course on building a blog and portfolio site. It walks through adding a contact form using the mail_form gem and sending the messages through SendGrid.

What people said

Recommends J.Salamanca · 2016-10 · Stack Overflow · on “How can I redirect with submit button in rails?”

i have read parts of the guide (its pretty long and i have like 3 days using rails) But i have much questions because of a tutorial i have seen and he does things like that D: [this video]

Cites Luis Barajas · 2015-12 · Stack Overflow · on “Undefined method true for (class) mail_form gem”

I am relatively new in Ruby on Rails programming, and I got this error when trying to use the mail_form gem. The error is in the create function as can be seen [LINK] I think I got all setup the correct way: My model is like this: class Contact < MailForm::Base attribute :name, :validate => :true attribute :email, :validate => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i attribute :message, :validate => :true attribute :nickname, :captcha => :true def headers { :subject => "Contact Form", :to => "(my email)", :from => %("#{name}" <#{email}>) } end end I don't know if matters that I'm trying to create a site with only one page, so I have the form to create a new contact in the welcome.html.er

Cites Seong Kim · 2016-04 · Stack Overflow · on “send email not working Using Sendgrid & mail_form for heroku app. I get NoMethodError in Contacts#create”

Hi I just followed tutorial setting up for email contact action from [this video] I have following: class ContactsController < ApplicationController def new @contact = Contact.new end def create @contact = Contact.new(params[:contact]) @contact.request = request if @contact.deliver flash.now[:error] = nil else flash.now[:error] = "Cannot send an email." render :new end end end class Contact < MailForm::Base attribute :name, :validate => true attribute :email, :validate => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i attribute :message def headers { :subject => "My Contact Form", :to => "testing@gmail.com", :from => %("#{name}" <#{email}>) } end end And I have views: views/contacts/new.html.erb <h

Cites Nathan Lauer · 2017-01 · Stack Overflow · on “Rails 5 mailform not sending mail”

I'm trying to build a contact us page in my rails 5 app using the mailform gem. I followed this youtube video explaining the process: [this video] However, I can't get the emails to actually deliver in either development or production mode, and I'm not really sure why. Any help would be much appreciated! Here's what I have: Welcome.rb: class Welcome < MailForm::Base attribute :name, :validate => true attribute :email, :validate => /\A([\w+\-].?)+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i attribute :message, :validate => true attribute :nickname, :captcha => true def headers { :subject => "Contact from About Site", :to => "my_email@gmail.com", :from => %("#{name}" <#{email}>) } end end welcome_controller:

Cites michaellim92 · 2020-05 · Stack Overflow · on “Getting <NoMethodError (undefined method `charset=` for > when submitting contact form through sendgrid”

I've recently graduated from a bootcamp so I'm still trying to wrap my head around things. I'm trying to implement a contact form on my rails app which I've used the mail_form gem together with sendgrid. I believe I've set the SMTP correctly. But when i try to submit the form i get this error: 2020-05-01T21:23:04.573941+00:00 app[web.1]: I, [2020-05-01T21:23:04.573868 #4] INFO -- : [268934ad-22d8-4836-b22a-3f130941a309] Parameters: {"utf8"=>"✓", "authenticity_token"=>"==auth==", "contact"=>{"email"=>"customer@gmail.com", "name"=>"josejose", "message"=>"jose here, first mesage"}, "commit"=>"Enviar Mensaje"} 2020-05-01T21:23:04.584676+00:00 app[web.1]: D, [2020-05-01T21:23:04.584577 #4] DEBUG