diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb new file mode 100644 index 0000000..17ed9d1 --- /dev/null +++ b/app/mailers/user_mailer.rb @@ -0,0 +1,6 @@ +class UserMailer < ApplicationMailer + def welcome_email(user) + @user = user + mail(to: @user.email, subject: 'Welcome to Anity Jobs') + end +end diff --git a/app/views/user_mailer/welcome_email.html.erb b/app/views/user_mailer/welcome_email.html.erb new file mode 100644 index 0000000..9f962a3 --- /dev/null +++ b/app/views/user_mailer/welcome_email.html.erb @@ -0,0 +1,6 @@ +
+ You have successfully signed up to example.com,
+ your username is: <%= @user.email %>.
+
Thanks for joining and have a great day!
\ No newline at end of file diff --git a/app/views/user_mailer/welcome_email.text.erb b/app/views/user_mailer/welcome_email.text.erb new file mode 100644 index 0000000..49073ea --- /dev/null +++ b/app/views/user_mailer/welcome_email.text.erb @@ -0,0 +1,5 @@ +Welcome to Anity jobs, <%= @user.email %> +=============================================== +You have successfully signed up to Anity jobs, +your username is: <%= @user.email %>. +Thanks for joining and have a great day! \ No newline at end of file diff --git a/config/environments/development.rb b/config/environments/development.rb index f284f62..fb70c86 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -39,7 +39,21 @@ config.active_storage.service = :local # Don't care if the mailer can't send. - config.action_mailer.raise_delivery_errors = false + + config.action_mailer.delivery_method = :smtp + config.action_mailer.perform_deliveries = true + config.action_mailer.raise_delivery_errors = true + config.action_mailer.default_options = {from: 'no-reply@example.com'} + + config.action_mailer.smtp_settings = { + address: 'smtp.gmail.com', + port: 587, + domain: 'example.com', + user_name: '