create email sending

parent c82beab1
class ApplicationMailer < ActionMailer::Base class ApplicationMailer < ActionMailer::Base
default from: 'phuocht@zigexn.vn' default from: 'phuoc2811006@gmail.com'
layout 'mailer' layout 'mailer'
end end
class UserMailer < ActionMailer::Base class UserMailer < ActionMailer::Base
def register_email(email) def register_email(email)
@email = email @email = email
mail(to: @email, subject: 'Welcome to My Awesome Site') mail(to: @email, subject: 'Welcome To VeNJOB! Confirm Your Email')
end end
end end
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<nav> <nav>
<ul class="navbar-nav mr-auto"> <ul class="navbar-nav mr-auto">
<li><%= link_to "Login", '#' , class: "nav-item nav-link" %></li> <li><%= link_to "Login", '#' , class: "nav-item nav-link" %></li>
<li><%= link_to "Register", '#', class: "nav-item nav-link" %></li> <li><%= link_to "Register", register_begin_path, class: "nav-item nav-link" %></li>
<li><%= link_to "Favorite", '#', class: "nav-item nav-link" %></li> <li><%= link_to "Favorite", '#', class: "nav-item nav-link" %></li>
<li><%= link_to "History", '#', class: "nav-item nav-link" %></li> <li><%= link_to "History", '#', class: "nav-item nav-link" %></li>
</ul> </ul>
......
...@@ -3,14 +3,9 @@ ...@@ -3,14 +3,9 @@
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' /> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head> </head>
<body> <body>
<h1>Welcome to example.com, <%= @email %></h1> <h1>Welcome to <%= @email %></h1>
<p> <p>You're on your way!</p>
You have successfully signed up to example.com, <p>Let's confirm your email address.</p>
your username is: <%= @email %>.<br> <p>By clicking on the following link, you are confirming your email address and agreeing to VeNJOB's Terms of Service</p>.
</p>
<p>
To login to the site, just follow this link:....
</p>
<p>Thanks for joining and have a great day!</p>
</body> </body>
</html> </html>
=================================================
Welcome to example.com, <%= @email %>
HELLO
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
<strong>Register</strong> <strong>Register</strong>
</div> </div>
<div class="row"> <div class="row">
<div class="text-center waiting-text">
</div>
Thank you for register our service, an confirmation email with registration link<br> Thank you for register our service, an confirmation email with registration link<br>
has been sent to your email. Please check your email within 24 hours.<br> has been sent to your email. Please check your email within 24 hours.<br>
Please note that the registration link is only valid for 24 hours.<br> Please note that the registration link is only valid for 24 hours.<br>
......
...@@ -31,18 +31,19 @@ Rails.application.configure do ...@@ -31,18 +31,19 @@ Rails.application.configure do
config.active_storage.service = :local config.active_storage.service = :local
# Don't care if the mailer can't send. # Don't care if the mailer can't send.
config.active_job.queue_adapter = :async # config.active_job.queue_adapter = :async
config.action_mailer.default_url_options = { host: "localhost:3000" }
# config.action_mailer.default_options = { from: 'support@venjob.com' } # config.action_mailer.default_options = { from: 'support@venjob.com' }
config.action_mailer.default_options = { from: 'phuoc2811006@gmail.com' }
config.action_mailer.default_url_options = { host: "localhost:3000" }
config.action_mailer.raise_delivery_errors = true config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { config.action_mailer.smtp_settings = {
address: "smtp.zigexn.vn", address: "smtp.gmail.com",
port: 587, port: 587,
domain: "zigexn.vn", domain: "localhost:3000",
user_name: ENV['GMAIL_USERNAME'], user_name: "phuoc2811006@gmail.com",
password: ENV['GMAIL_PASSWORD'], password: "Phuoc123",
authentication: "plain", authentication: "plain",
enable_starttls_auto: true enable_starttls_auto: true
} }
......
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
# config.action_mailer.default_options = { from: 'phuoc2811006@gmail.com' }
# config.action_mailer.default_url_options = { host: "localhost:3000" }
# config.action_mailer.raise_delivery_errors = true
# config.action_mailer.perform_deliveries = true
# config.action_mailer.delivery_method = :smtp
# config.action_mailer.smtp_settings = {
# address: "smtp.gmail.com",
# port: 587,
# domain: "localhost:3000",
# user_name: "phuoc2811006@gmail.com",
# password: "Phuoc123",
# authentication: "plain",
# enable_starttls_auto: true
# }
# Code is not reloaded between requests. # Code is not reloaded between requests.
config.cache_classes = true config.cache_classes = true
......
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
# config.action_mailer.default_options = { from: 'phuoc2811006@gmail.com' }
# The test environment is used exclusively to run your application's # The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that # test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped # your test database is "scratch space" for the test suite and is wiped
......
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
# For example, setting: # For example, setting:
# GMAIL_USERNAME: 'Your_Gmail_Username' # GMAIL_USERNAME: 'Your_Gmail_Username'
# makes 'Your_Gmail_Username' available as ENV["GMAIL_USERNAME"] # makes 'Your_Gmail_Username' available as ENV["GMAIL_USERNAME"]
GMAIL_USERNAME: 'phuocht@zigexn.vn' # GMAIL_USERNAME: 'phuocht@zigexn.vn'
GMAIL_PASSWORD: 'Thienphuoc123' # GMAIL_PASSWORD: 'Thienphuoc0123'
# PASSWORD_TPM: 'vjkjlbgoxqxvnbac' # PASSWORD_TPM: 'xaxxfxobotthglsm'
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