create email sending

parent c82beab1
class ApplicationMailer < ActionMailer::Base
default from: 'phuocht@zigexn.vn'
default from: 'phuoc2811006@gmail.com'
layout 'mailer'
end
class UserMailer < ActionMailer::Base
def register_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
......@@ -5,7 +5,7 @@
<nav>
<ul class="navbar-nav mr-auto">
<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 "History", '#', class: "nav-item nav-link" %></li>
</ul>
......
......@@ -3,14 +3,9 @@
<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 username is: <%= @email %>.<br>
</p>
<p>
To login to the site, just follow this link:....
</p>
<p>Thanks for joining and have a great day!</p>
<h1>Welcome to <%= @email %></h1>
<p>You're on your way!</p>
<p>Let's confirm your email address.</p>
<p>By clicking on the following link, you are confirming your email address and agreeing to VeNJOB's Terms of Service</p>.
</body>
</html>
=================================================
Welcome to example.com, <%= @email %>
HELLO
......@@ -3,6 +3,9 @@
<strong>Register</strong>
</div>
<div class="row">
<div class="text-center waiting-text">
</div>
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>
Please note that the registration link is only valid for 24 hours.<br>
......
......@@ -31,18 +31,19 @@ Rails.application.configure do
config.active_storage.service = :local
# Don't care if the mailer can't send.
config.active_job.queue_adapter = :async
config.action_mailer.default_url_options = { host: "localhost:3000" }
# config.active_job.queue_adapter = :async
# 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.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.zigexn.vn",
address: "smtp.gmail.com",
port: 587,
domain: "zigexn.vn",
user_name: ENV['GMAIL_USERNAME'],
password: ENV['GMAIL_PASSWORD'],
domain: "localhost:3000",
user_name: "phuoc2811006@gmail.com",
password: "Phuoc123",
authentication: "plain",
enable_starttls_auto: true
}
......
Rails.application.configure do
# 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.
config.cache_classes = true
......
Rails.application.configure do
# 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
# 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
......
......@@ -6,6 +6,6 @@
# For example, setting:
# GMAIL_USERNAME: 'Your_Gmail_Username'
# makes 'Your_Gmail_Username' available as ENV["GMAIL_USERNAME"]
GMAIL_USERNAME: 'phuocht@zigexn.vn'
GMAIL_PASSWORD: 'Thienphuoc123'
# PASSWORD_TPM: 'vjkjlbgoxqxvnbac'
# GMAIL_USERNAME: 'phuocht@zigexn.vn'
# GMAIL_PASSWORD: 'Thienphuoc0123'
# 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