Commit 882536bd by thanhnd

send email confirm for user apply job

parent 7aa058de
Pipeline #628 failed with stages
in 0 seconds
...@@ -19,6 +19,9 @@ class JobsController < ApplicationController ...@@ -19,6 +19,9 @@ class JobsController < ApplicationController
email: form_params[:email], email: form_params[:email],
cv_url: uploader.url) cv_url: uploader.url)
session[:apply_job] = @apply_job session[:apply_job] = @apply_job
end end
def done def done
...@@ -28,6 +31,9 @@ class JobsController < ApplicationController ...@@ -28,6 +31,9 @@ class JobsController < ApplicationController
email: session[:apply_job]["email"], email: session[:apply_job]["email"],
cv_url: session[:apply_job]["cv_url"]) cv_url: session[:apply_job]["cv_url"])
apply_job.save! apply_job.save!
#send email for user applied
JobMailer.with(name: session[:apply_job]["fullname"], email: session[:apply_job]["email"], job_id: session[:job_id], cv_url: session[:apply_job]["cv_url"]).welcome_email.deliver_now
end end
......
class JobMailer < ApplicationMailer
default from: 'notifications@example.com'
def welcome_email
@email = params[:email]
@job = Job.find(params[:job_id])
@name = params[:name]
@cv_url = params[:cv_url]
mail(to: @email, subject: 'Welcome to My Awesome Site')
end
end
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<h1>Welcome to example.com, <%= @email %></h1>
<p>
You have successfully signed up to example.com,
your email is: <%= @email %>.<br>
</p>
<p>
your job id is: <%= @job.job_name %>.<br>
</p>
<p>
your cv url is: <%= @cv_url %>.<br>
</p>
<p>
your name id is: <%= @name %>.<br>
</p>
<p>Thanks for joining and have a great day!</p>
</body>
</html>
Welcome to example.com, <%= @email %>
===============================================
You have successfully signed up to example.com,
your username is: <%= @email %>.
your jobname is: <%= @job.job_name %>.
your jobname is: <%= @name %>.
your jobname is: <%= @cv_url %>.
To login to the site, just follow this link: <%= @url %>.
Thanks for joining and have a great day!
...@@ -4,6 +4,8 @@ Rails.application.configure do ...@@ -4,6 +4,8 @@ Rails.application.configure do
# In the development environment your application's code is reloaded on # In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development # every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes. # since you don't have to restart the web server when you make code changes.
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }
config.cache_classes = false config.cache_classes = false
# Do not eager load code on boot. # Do not eager load code on boot.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment