Skip to content

Commit 8ce4d48

Browse files
committed
fix email sending
1 parent 4d5c8d8 commit 8ce4d48

File tree

6 files changed

+147
-3
lines changed

6 files changed

+147
-3
lines changed

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"Bash(git add:*)",
55
"Bash(git commit:*)",
66
"Bash(git push:*)",
7-
"Bash(curl:*)"
7+
"Bash(curl:*)",
8+
"Bash(mkdir:*)"
89
],
910
"deny": []
1011
}

app/mailers/test_mailer.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class TestMailer < ApplicationMailer
2+
def test_email(recipient_email)
3+
@recipient_email = recipient_email
4+
@test_time = Time.current
5+
@environment = Rails.env
6+
7+
mail(
8+
to: recipient_email,
9+
subject: "[OutcomeTracker] Test Email - #{Rails.env.capitalize}"
10+
)
11+
end
12+
end
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5+
<style>
6+
body {
7+
font-family: Arial, sans-serif;
8+
line-height: 1.6;
9+
color: #333;
10+
max-width: 600px;
11+
margin: 0 auto;
12+
padding: 20px;
13+
}
14+
.header {
15+
background-color: #007bff;
16+
color: white;
17+
padding: 20px;
18+
text-align: center;
19+
border-radius: 5px 5px 0 0;
20+
}
21+
.content {
22+
background-color: #f8f9fa;
23+
padding: 20px;
24+
border: 1px solid #dee2e6;
25+
border-radius: 0 0 5px 5px;
26+
}
27+
.info-table {
28+
width: 100%;
29+
margin-top: 20px;
30+
border-collapse: collapse;
31+
}
32+
.info-table td {
33+
padding: 10px;
34+
border-bottom: 1px solid #dee2e6;
35+
}
36+
.info-table td:first-child {
37+
font-weight: bold;
38+
width: 40%;
39+
background-color: #e9ecef;
40+
}
41+
.footer {
42+
margin-top: 20px;
43+
text-align: center;
44+
font-size: 12px;
45+
color: #666;
46+
}
47+
.success-message {
48+
background-color: #d4edda;
49+
color: #155724;
50+
padding: 15px;
51+
border-radius: 5px;
52+
border: 1px solid #c3e6cb;
53+
margin: 20px 0;
54+
}
55+
</style>
56+
</head>
57+
58+
<body>
59+
<div class="header">
60+
<h1>OutcomeTracker Test Email</h1>
61+
</div>
62+
63+
<div class="content">
64+
<div class="success-message">
65+
<strong>Success!</strong> This is a test email from your OutcomeTracker application.
66+
If you're receiving this email, it means your email configuration is working correctly.
67+
</div>
68+
69+
<h2>Email Configuration Details</h2>
70+
<table class="info-table">
71+
<tr>
72+
<td>Recipient</td>
73+
<td><%= @recipient_email %></td>
74+
</tr>
75+
<tr>
76+
<td>Sent From</td>
77+
<td>noreply@apps.buildcanada.com</td>
78+
</tr>
79+
<tr>
80+
<td>Environment</td>
81+
<td><%= @environment.capitalize %></td>
82+
</tr>
83+
<tr>
84+
<td>Timestamp</td>
85+
<td><%= @test_time.strftime("%B %d, %Y at %I:%M %p %Z") %></td>
86+
</tr>
87+
<tr>
88+
<td>Rails Version</td>
89+
<td><%= Rails.version %></td>
90+
</tr>
91+
</table>
92+
93+
<h3>Next Steps</h3>
94+
<ul>
95+
<li>Verify that the email was delivered to your inbox (check spam folder if needed)</li>
96+
<li>Check that all formatting appears correctly</li>
97+
<li>Confirm the sender address is correct</li>
98+
<li>Test with different email addresses if needed</li>
99+
</ul>
100+
</div>
101+
102+
<div class="footer">
103+
<p>This is an automated test email from OutcomeTracker.</p>
104+
<p>Please do not reply to this email.</p>
105+
</div>
106+
</body>
107+
</html>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
OutcomeTracker Test Email
2+
========================
3+
4+
Success! This is a test email from your OutcomeTracker application.
5+
If you're receiving this email, it means your email configuration is working correctly.
6+
7+
Email Configuration Details:
8+
---------------------------
9+
Recipient: <%= @recipient_email %>
10+
Sent From: noreply@apps.buildcanada.com
11+
Environment: <%= @environment.capitalize %>
12+
Timestamp: <%= @test_time.strftime("%B %d, %Y at %I:%M %p %Z") %>
13+
Rails Version: <%= Rails.version %>
14+
15+
Next Steps:
16+
-----------
17+
- Verify that the email was delivered to your inbox (check spam folder if needed)
18+
- Check that all formatting appears correctly
19+
- Confirm the sender address is correct
20+
- Test with different email addresses if needed
21+
22+
---
23+
This is an automated test email from OutcomeTracker.
24+
Please do not reply to this email.

config/environments/production.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
config.action_mailer.smtp_settings = {
6464
user_name: Rails.application.credentials.dig(:smtp, :user_name),
6565
password: Rails.application.credentials.dig(:smtp, :password),
66-
address: "smtp.example.com",
66+
address: Rails.application.credentials.dig(:smtp, :address),
6767
port: 587,
6868
authentication: :plain
6969
}

config/initializers/devise.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# Configure the e-mail address which will be shown in Devise::Mailer,
1818
# note that it will be overwritten if you use your own mailer class
1919
# with default "from" parameter.
20-
config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
20+
config.mailer_sender = "noreply@apps.buildcanada.com"
2121

2222
# Configure the class responsible to send e-mails.
2323
# config.mailer = 'Devise::Mailer'

0 commit comments

Comments
 (0)