You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tweak: clarify Nodemailer section in email testing documentation
- Clarified that the Nodemailer example is for testing MailHog setup\n- Added information about how Puter uses Nodemailer\n- Added references to the EmailService class
ai: true
Copy file name to clipboardExpand all lines: doc/contributors/email_testing.md
+23-5Lines changed: 23 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,32 +43,50 @@ Once MailHog is running, access the web interface at:
43
43
44
44
All captured emails and their recipients will be displayed in this interface.
45
45
46
-
### Sending Test Emails with Nodemailer
46
+
### Testing Your MailHog Setup with Nodemailer
47
47
48
-
Use Nodemailer as the transport method to send emails via SMTP. These emails will be captured by MailHog:
48
+
You can verify that your MailHog instance is working correctly by creating a simple test script using Nodemailer. This allows you to send test emails that will be captured by MailHog without actually delivering them to real recipients.
49
+
50
+
Here's a sample script you can use to test your MailHog setup:
49
51
50
52
```javascript
51
53
importnodemailerfrom"nodemailer";
52
54
55
+
// Configure transporter to use MailHog
53
56
consttransporter=nodemailer.createTransport({
54
-
host:"localhost", // SMTP server (MailHog in this case)
After sending an email, you can view it in the MailHog web interface:
76
+
After sending an email with this script, you can view it in the MailHog web interface:
77
+
78
+
### How Puter Uses Nodemailer
79
+
80
+
Puter itself uses Nodemailer for sending emails through its `EmailService` class located in `/src/backend/src/services/EmailService.js`. This service handles various email templates for:
81
+
82
+
- Account verification
83
+
- Password recovery
84
+
- Two-factor authentication notifications
85
+
- File sharing notifications
86
+
- App approval notifications
87
+
- And more
88
+
89
+
The service creates a Nodemailer transport using the configuration from your `config.json` file, which is why setting up MailHog correctly is important for testing Puter's email functionality during development.
72
90
73
91
<imgsrc="image.png"alt="Email in MailHog interface"width="300"height="200">
0 commit comments