Ruby On Rails - Send confirmation emails for users who sign up to your app

  Рет қаралды 12,092

CodeCampBase

CodeCampBase

Күн бұрын

Пікірлер: 53
@JEDIXXXX1
@JEDIXXXX1 4 жыл бұрын
Hello everyone, Since April 2020, we need to set a sender identity on SendGrid, even for free tests. Follow the process as indicated by Sendgrid, and don't forget to use the verified mail address on the config.mailer_sender in devise.rb !
@codecampbase1525
@codecampbase1525 4 жыл бұрын
Thanks for posting! I should finally have in July a computer again and will then finally create new tutorials as well!
@codecampbase1525
@codecampbase1525 5 жыл бұрын
Do you guys want to see more Rails stuff or Laravel stuff? Or anything else you want might want to see on this channel? Let me know! Happy Coding!
@tsheni
@tsheni 5 жыл бұрын
More Rails stuff, please.
@萧尘-f7h
@萧尘-f7h 5 жыл бұрын
if you have more time,you can look 4 person channel(Ryan Hemrick/BarbieTechFabulous/Andy Leverenz/Mackenzie Child),and then,do some more cases to help students improve more quickly,In particular,payment can be added to the link。thank you。
@anjitbaral5893
@anjitbaral5893 5 жыл бұрын
Rails with design pattern. 😊
@riddhikumari4540
@riddhikumari4540 5 жыл бұрын
Hi, I followed your video but it didn't work for me. The resend email confirmation is working fine, but whenever a user signs up, no email confirmation is being sent. Could you please tell me where am I going wrong?
@anissmarrouch282
@anissmarrouch282 4 жыл бұрын
thank you this was a really good tutorial
@fazzyakamello
@fazzyakamello 5 жыл бұрын
Bro i just found your channel! you're a "gem" haha. keep it up, i am learning ruby on rails so im finding your video tuts useful!
@codecampbase1525
@codecampbase1525 5 жыл бұрын
Thanks for the kind words! There is even much more in the making! Good decision on learning Rails, while it takes some time to understand its "magic", its totally worth it for two reasons: Once you understand it's magic, you'll become super productive and also, everything that you are going to learn in Rails can be applied to pretty much every other framework / tech stack out there!
@josephandres4324
@josephandres4324 5 жыл бұрын
I'm getting this error: Net::ReadTimeout with # the user is created, and in console shows the same log that in the video, but the email is not sent. I'm developing in a vagrant box.
@codecampbase1525
@codecampbase1525 5 жыл бұрын
Hey, so this must be vagrant related, because i never seen such an error before. Could you check out stackoverflow for this particular problem and report back if you could find a solution?
@codecampbase1525
@codecampbase1525 5 жыл бұрын
Belawal Umer hey! Im sorry to tell you but i never used vagrant and have no idea what the issue could be. Could you check out Stackoverflow or Google with this error message, as is must Vagrant related. I hope you can find a solution. Other than that, you could try using rails without the vagrant box. Greetings
@adegbitekelvin3875
@adegbitekelvin3875 5 жыл бұрын
Thanks for the tutorial. For whatever reason, this isn't working for me. I'm working on rails 6 environment, the email is sent in the terminal but not in my inbox. I checked the spam folder too.
@codecampbase1525
@codecampbase1525 5 жыл бұрын
Hey! Sorry for the late reply, for some reason your comment appeared in my spam. Any chances you have your project on GitHub? I could check it out there. Also, have you set the localhost to 3000 for the actionmailer in development? It's kinda hard to debug without source or any errors. If you could drop the GitHub repo link i could definitely check it out! Cheers!
@anjitbaral5893
@anjitbaral5893 5 жыл бұрын
Keep going on brother, you are amazing.
@codecampbase1525
@codecampbase1525 5 жыл бұрын
Thanks for your kind words! You're amazing as well! Keep hacking!
@TylerVanzo
@TylerVanzo 5 жыл бұрын
why do you need to use that service? doesn't action directly send without need of this service? bit confused. in the official tutorial from action mailer it makes it seem so?
@codecampbase1525
@codecampbase1525 5 жыл бұрын
Hey! I never have seen this really without any third party integration. I guess the benefits from using one is that you get all security things right out of the box, mail lists, promotional emails, support etc. To my knowledge, ActionMailer needs some stmp provider to handle emails.
@TylerVanzo
@TylerVanzo 5 жыл бұрын
@@codecampbase1525 thanks a lot for the quick reply, working on implementing this atm, I am clueless so I am sure u are right haha. just saw some other tutorials that seem to have the function without that step, not sure. cheers
@TylerVanzo
@TylerVanzo 5 жыл бұрын
@@codecampbase1525 my main problem is I am running into this error! not sure what is going on for the life of me haha: [ActiveJob] [ActionMailer::DeliveryJob] [a0b45c96-7797-4338-8d83-76934cdcbc1c] Error performing ActionMailer::DeliveryJob (Job ID: a0b45c96-7797-4338-8d83-76934cdcbc1c) from Async(mailers) in 189.05ms: ActionView::MissingTemplate (Missing template user_mailer/welcome_email with "mailer". Searched in: * "user_mailer"
@codecampbase1525
@codecampbase1525 5 жыл бұрын
@@TylerVanzo You're welcome! Your error says: ActionView::MissingTemplate (Missing template user_mailer/welcome_email Go inside the app folder, head over to the mailer folder and create inside there a user_mailer folder. Then, inside the user_mailer folder create a new html file called 'welcome_email.html'. This will serve as your template email that you will send out. The path should be: app/mailers/user_mailer/welcome_email.html
@TylerVanzo
@TylerVanzo 5 жыл бұрын
Wait...I am just realizing now...why aren't you using ActionMailer?
@JEDIXXXX1
@JEDIXXXX1 4 жыл бұрын
Hello, many thanks for your tutorial! As I saw in some previous comments, something goes wrong for me. The email is sent in the terminal but not in my inbox. I checked the spam folder too. I also have set config.action_mailer.default_url_options = { host: "localhost:3000" } in my development.rb. I also set config.action_mailer.perform_deliveries = true as @Yossef suggested. There is no activity in my sendgrid dashboard and when I try to verify from the site, they don't manage to reach my app neither ('Hmm, we haven't seen your email yet.' as they say) Any idea how to fix this? Thanks again!
@codecampbase1525
@codecampbase1525 4 жыл бұрын
Have you added your own credentials with the api keys in your rails app? Double check these. Also, try to send from sendgrid itself an email to see if it works.
@JEDIXXXX1
@JEDIXXXX1 4 жыл бұрын
@@codecampbase1525 Thanks for your answer. I did add my own credentials, but even in Sendgrid it doesn't work. I set config.action_mailer.raise_delivery_errors = true and I have this error: Net::ReadTimeout in Devise::PasswordsController#create Net::ReadTimeout with # Extracted source (around line #217): return when :wait_readable (io = @io.to_io).wait_readable(@read_timeout) or raise Net::ReadTimeout.new(io) # continue looping when :wait_writable # OpenSSL::Buffering#read_nonblock may fail with IO::WaitWritable. I tried to google it but it's very confusing to me. What do you think?
@codecampbase1525
@codecampbase1525 4 жыл бұрын
Hey! So if you can’t send emails trough the sendgrid dashboard, it won’t work in Rails either. Ignore Rails for now and try to successful send an e-mail with sendgrid without Rails. Your error states the timeout, meaning it probably can’t reach the smtp address from sendgrid. Could you drop me your GitHub repo so that I can take a look at it? You can replace your credentials with something like “xxxx” on your GitHub repo, although that’s less because of me but because someone else could see them and misuse them.
@JEDIXXXX1
@JEDIXXXX1 4 жыл бұрын
@@codecampbase1525 Sorry to bother you and many thanks for your concern. I am confused because in the sendgrid documentation for action mailer set up here: sendgrid.com/docs/for-developers/sending-email/rubyonrails/ the code is different. They use the api_key. ActionMailer::Base.smtp_settings = { :user_name => 'your_sendgrid_username', :api_key => 'your_sendgrid_api_key', :domain => 'yourdomain.com', :address => 'smtp.sendgrid.net', :port => 465, :authentication => :plain, :enable_starttls_auto => true } I tried with those parameters but now I have another error:SMTP-AUTH requested but missing secret phrase + I am for now just trying to make the reset password mail to works, not the confirmation. Anyway, my github repo : github.com/cecileRx/BRAVA_COFFEES Thank you so much!
@codecampbase1525
@codecampbase1525 4 жыл бұрын
JEDIXXXX1 no need to thank me, you're welcome. So there are several things that you need to change: first off, in your user.rb file from devise, you have not added :confirmable to your module stack. You also have not added the confirmed_token and other columns to your devise user schema data, as shown in the video. And finally, you need to remove the ActionMailer::Base.smtp_settings from development.rb and move it over to environment.eb, just as shown in the video. I am not sure if you are familiar with adding migrations to an existing schema, because thats what you need to do for your user table from devise, in order to make this work. if you are not familiar with that and how to add new columns to an existing table, i highly suggest you to try to redo the tutorial with a complete fresh project just like i do in my video step by step and see if that works out for you. To fix your project, do the steps above. Then, run rails db:setup (this will remove existing data, so keep that in mind). Then you need to add the new migrations for your user, confirmation_token etc. as shown in the video. Then run rails db:migrate and just for good measurement again rails db:setup. If you don't know how to add migrations, let me now and ill see if i can fix your repo somewhere around this week. But before you do anything, just redo the tutorial first with an empty, fresh project, just like i do in the video and follow it step by step to see if that works out for you and report back if it worked! Greetings!
@guled669
@guled669 3 жыл бұрын
Update) If anyone has problem setting up sendgrid, I have managed to get this working by using my personal outlook account. So that may be an easier alternative for some people than setting up a third party service and figuring out how to point DNS and setting up Domain
@asolab
@asolab 2 жыл бұрын
heyy
@theyoussefnassar
@theyoussefnassar 4 жыл бұрын
it didn't work for me until a wrote config.action_mailer.perform_deliveries = true in the development.rb file
@codecampbase1525
@codecampbase1525 4 жыл бұрын
Which Rails version are you using? Greetings
@theyoussefnassar
@theyoussefnassar 4 жыл бұрын
@@codecampbase1525 Rails 6.0.3.2 But later I had some problems with sendgrid that I couldn't solve so switched to gmail
@angemanto2051
@angemanto2051 3 жыл бұрын
Thanks Sir for your Video.
@kensanchez2064
@kensanchez2064 5 жыл бұрын
great tutorial. But Im having issues deploying this on heroku. Any help please? thanks!
@codecampbase1525
@codecampbase1525 5 жыл бұрын
Thank you! Depending on the service you want to use, make sure to check out the docs on heroku: devcenter.heroku.com/articles/sendgrid . Let me know if this helped you. Greetings!
@kensanchez2064
@kensanchez2064 5 жыл бұрын
@@codecampbase1525 HEY! Thanks for the quick response. It did work bit heroku says i'm missing something. Did I need to add something from the schema? On localhost is fine but fails in heroku. Ive donde overstack all night and nothing. NameError (undefined local variable or method `confirmed_at' for # Did you mean? confirmed?):
@codecampbase1525
@codecampbase1525 5 жыл бұрын
Ken Sánchez no problem! Have you uploaded your project it to GitHub? It would be much easier this way. Otherwise its kinda hard to tell. Make sure you run db migrate on heroku and reset your database on heroku and remigrate it.
@kensanchez2064
@kensanchez2064 5 жыл бұрын
@@codecampbase1525 I made it worked. I just dropped all the migrations. Created a new schema, deploed an vuala! Thanks man!
@codecampbase1525
@codecampbase1525 5 жыл бұрын
Ken Sánchez nice work! Glad it worked!. Happy coding!
@adrianpaluch3528
@adrianpaluch3528 5 жыл бұрын
Could you tell something about what if sending email doesn't work? In your solution it'll be impossible to create a new user with the same email :)
@codecampbase1525
@codecampbase1525 5 жыл бұрын
Hey! So do you have any errors? You can use any email you want, but sendgrid gives you for the free sandbox just one adress. If something went wrong on the backend side in sendgrid but you successfully registered a new user in your rails app, all you need to do is to delete the user.
@adrianpaluch3528
@adrianpaluch3528 5 жыл бұрын
@@codecampbase1525 No, I don't have errors but I'm wondering from another pesrspective - user perspective. What's the good practice? What solutions should I give to the new user if something goes wrong and the mail doesn't reach to mailbox? That could happens :)
@codecampbase1525
@codecampbase1525 5 жыл бұрын
Adrian Paluch Simply add a link to resend the activation email.
@rubyrails2329
@rubyrails2329 5 жыл бұрын
Huge help, thanks a lot
@codecampbase1525
@codecampbase1525 5 жыл бұрын
Thanks! Make sure to check out my other tutorials on my channel and if you like my content make sure to subscribe! Have a great evening!
Send Admin Emails on User Sign Up with Rails 7 & Devise
13:30
Ruby on Rails - ECommerce Shopping Card in 30 minutes
33:48
CodeCampBase
Рет қаралды 21 М.
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
Rails - Nested Forms in Rails | [Tutorial]
35:35
CodeCampBase
Рет қаралды 9 М.
How to Create, Preview, and Send Email From Your Rails App
21:53
The Pragmatic Studio
Рет қаралды 25 М.
Adding confirmable module to existing devise resource
11:46
APPSIMPACT Academy
Рет қаралды 424
How to DEPLOY a RAILS 6 APP to HEROKU - RUBY ON RAILS TUTORIAL
10:15
David Battersby
Рет қаралды 12 М.
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН