Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
venjob
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Huỳnh Thiên Phước
venjob
Commits
c82beab1
Commit
c82beab1
authored
Aug 18, 2020
by
Huỳnh Thiên Phước
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create sender mailer
parent
4d40a363
Pipeline
#951
canceled with stages
in 0 seconds
Changes
14
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
51 additions
and
45 deletions
+51
-45
app/assets/stylesheets/register_emails.scss
+1
-0
app/controllers/users_controller.rb
+4
-7
app/mailers/application_mailer.rb
+1
-1
app/mailers/previews/user_mailer_preview.rb
+0
-5
app/mailers/user_mailer.rb
+2
-3
app/mailers/user_mailer/welcome_email.text.erb
+0
-5
app/views/user_mailer/register_email.html.erb
+5
-2
app/views/user_mailer/register_email.text.erb
+4
-0
app/views/users/new.html.erb
+5
-3
config/application.rb
+0
-1
config/environments/development.rb
+15
-14
config/local_env.yml
+11
-0
config/locales/en.yml
+0
-2
config/routes.rb
+3
-2
No files found.
app/assets/stylesheets/register_emails.scss
View file @
c82beab1
...
...
@@ -21,3 +21,4 @@
.text-confirm
{
font-size
:
26px
;
}
app/controllers/users_controller.rb
View file @
c82beab1
class
UsersController
<
ApplicationController
def
new
end
def
register_begin
@email
=
User
.
new
(
params
[
:email
])
@email
=
User
.
new
end
def
create
@email
=
User
.
new
(
params
[
:email
])
@email
=
User
.
new
(
email:
params
[
:user
]
[
:email
])
if
@email
.
save
UserMailer
.
with
(
email:
@email
).
welcome_email
.
deliver_later
binding
.
pry
UserMailer
.
register_email
(
params
[
:user
][
:email
]).
deliver_later
redirect_to
mail_register_path
else
redirect_to
register_begin_path
...
...
app/mailers/application_mailer.rb
View file @
c82beab1
class
ApplicationMailer
<
ActionMailer
::
Base
default
from:
'
from@example.com
'
default
from:
'
phuocht@zigexn.vn
'
layout
'mailer'
end
app/mailers/previews/user_mailer_preview.rb
deleted
100644 → 0
View file @
4d40a363
class
UserMailerPreview
<
ActionMailer
::
Preview
def
welcome_email
UserMailer
.
with
(
email:
User
.
first
).
welcome_email
end
end
app/mailers/user_mailer.rb
View file @
c82beab1
class
UserMailer
<
ActionMailer
::
Base
default
from:
'phuocht@gmail.com'
def
welcome_email
@email
=
params
[
:email
]
def
register_email
(
email
)
@email
=
email
mail
(
to:
@email
,
subject:
'Welcome to My Awesome Site'
)
end
end
app/mailers/user_mailer/welcome_email.text.erb
deleted
100644 → 0
View file @
4d40a363
===============================================
You have successfully signed up to gmail.com,
Thanks for joining and have a great day!
app/
mailers/user_mailer/welcome
_email.html.erb
→
app/
views/user_mailer/register
_email.html.erb
View file @
c82beab1
...
...
@@ -3,10 +3,13 @@
<meta
content=
'text/html; charset=UTF-8'
http-equiv=
'Content-Type'
/>
</head>
<body>
<h1>
Welcome to example.com,
<%=
@user
.
name
%>
</h1>
<h1>
Welcome to example.com,
<%=
@email
%>
</h1>
<p>
You have successfully signed up to example.com,
your username is: sadsad.
<br>
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>
</body>
...
...
app/views/user_mailer/register_email.text.erb
0 → 100644
View file @
c82beab1
=================================================
Welcome to example.com,
<%=
@email
%>
HELLO
app/views/users/
register_begin
.html.erb
→
app/views/users/
new
.html.erb
View file @
c82beab1
...
...
@@ -3,12 +3,14 @@
<div
class=
"text-center label"
>
<strong>
Register
</strong>
</div>
<div
class=
"
row
"
>
<div
class=
"
form-register
"
>
<%=
form_for
(
@email
)
do
|
f
|
%>
<div
class=
"text-center email-input"
>
<strong>
Email
</strong>
<%=
f
.
text_field
:email
,
class:
'col-6'
%>
<%=
f
.
text_field
:email
%>
</div>
<div
class=
"text-center confirm-email-btn"
>
<%=
f
.
submit
'Confirm your email'
,
class:
'btn btn-outline-danger confirm'
%>
<%=
f
.
submit
'Confirm your email'
,
class:
'btn btn-outline-danger confirm
font-weight-bold
'
%>
</div>
<%
end
%>
</div>
...
...
config/application.rb
View file @
c82beab1
...
...
@@ -10,7 +10,6 @@ module Venjob
class
Application
<
Rails
::
Application
# Initialize configuration defaults for originally generated Rails version.
config
.
load_defaults
5.2
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
...
...
config/environments/development.rb
View file @
c82beab1
...
...
@@ -27,24 +27,25 @@ Rails.application.configure do
config
.
cache_store
=
:null_store
end
config
.
action_mailer
.
delivery_method
=
:smtp
config
.
action_mailer
.
default_url_options
=
{
:host
=>
"localhost:3000"
}
config
.
action_mailer
.
smtp_settings
=
{
:address
=>
"smtp.gmail.com"
,
:port
=>
587
,
:domain
=>
"gmail.com"
,
:user_name
=>
ENV
[
'GMAIL_USERNAME'
],
:password
=>
ENV
[
'GMAIL_PASSWORD'
],
:authentication
=>
"plain"
,
:enable_starttls_auto
=>
true
}
# Store uploaded files on the local file system (see config/storage.yml for options)
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.action_mailer.default_options = { from: 'support@venjob.com' }
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"
,
port:
587
,
domain:
"zigexn.vn"
,
user_name:
ENV
[
'GMAIL_USERNAME'
],
password:
ENV
[
'GMAIL_PASSWORD'
],
authentication:
"plain"
,
enable_starttls_auto:
true
}
config
.
action_mailer
.
perform_caching
=
false
...
...
config/local_env.yml
0 → 100644
View file @
c82beab1
# Rename this file to local_env.yml
# Add account settings and API keys here.
# This file should be listed in .gitignore to keep your settings secret!
# Each entry gets set as a local environment variable.
# This file overrides ENV variables in the Unix shell.
# 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'
config/locales/en.yml
View file @
c82beab1
...
...
@@ -28,8 +28,6 @@
#
# To learn more, please read the Rails Internationalization guide
# available at http://guides.rubyonrails.org/i18n.html.
GMAIL_USERNAME
:
'
phuocht@zigexn.vn'
GMAIL_PASSWORD
:
'
Thienphuoc0123'
en
:
hello
:
"
Hello
world"
config/routes.rb
View file @
c82beab1
...
...
@@ -2,13 +2,14 @@ Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
resources
:jobs
get
'detail/:id'
,
action: :show
,
controller:
'jobs'
,
as: :job_detail
match
'/register/1'
,
to:
'users#register_begin'
,
via:
'get
'
,
as: :register_begin
match
'/register/2'
,
to:
'users#mail_register'
,
via:
'get
'
,
as: :mail_register
get
'/register/1'
,
to:
'users#new
'
,
as: :register_begin
get
'/register/2'
,
to:
'users#mail_register
'
,
as: :mail_register
get
'jobs/city/:converted_name'
,
to:
'jobs#city_jobs'
,
as: :city_jobs
get
'jobs/industry/:converted_name'
,
to:
'jobs#industry_jobs'
,
as: :industry_jobs
get
'jobs/company/:converted_name'
,
to:
'jobs#company_jobs'
,
as: :company_jobs
resources
:user_mailer
resources
:users
resources
:top_pages
resources
:industries
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment