Use custom smtp relay for email transport#2077
Use custom smtp relay for email transport#2077Calanas wants to merge 8 commits intotrycompai:mainfrom
Conversation
|
@Calanas is attempting to deploy a commit to the Comp AI Team on Vercel. A member of the Team first needs to authorize it. |
PR SummaryMedium Risk Overview Email senders in Written by Cursor Bugbot for commit 99b67c9. This will update automatically on new commits. Configure here. |
Signed-off-by: Andreas Reußner <andreas.reussner@rgigroup.com>
Signed-off-by: Andreas Reußner <andreas.reussner@rgigroup.com>
Signed-off-by: Andreas Reussner <andreas.reussner@rgigroup.com>
Signed-off-by: Andreas Reußner <andreas.reussner@rgigroup.com>
Signed-off-by: Andreas Reussner <andreas.reussner@rgigroup.com>
Signed-off-by: Andreas Reußner <andreas.reussner@outlook.de>
- add warning for mail scheduling - add runtime environment variables Signed-off-by: Andreas Reußner <andreas.reussner@outlook.de>
54c651c to
8ddd95b
Compare
Signed-off-by: Andreas Reußner <andreas.reussner@rgigroup.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| code: 'mail-config', | ||
| message: 'Set RESEND_API_KEY or all RELAY_SMTP_* values.', | ||
| path: ['RESEND_API_KEY', ...relayKeys], | ||
| }); |
There was a problem hiding this comment.
Invalid Zod issue code breaks env validation contract
Medium Severity
The code: 'mail-config' passed to ctx.addIssue() is not a valid ZodIssueCode. Zod's addIssue in superRefine expects one of the predefined issue codes (e.g., 'custom', 'invalid_type'). For custom validation errors, the correct value is z.ZodIssueCode.custom (the string 'custom'). Because these are .mjs files, TypeScript won't catch this, and while current Zod v3 happens to be lenient at runtime, this is incorrect API usage that will likely break on upgrade to Zod 4.


What does this PR do?
Alternatively, it is now possible to use a custom (SMTP) mail server for email transport. The goal is to connect this application to an already existing infrastructure and to reduce the number of external (meaning outside the company boundaries) dependencies.
Resend will still be the default. But for companies who cannot use online services that easily, the SMTP relay might be a proper alternative.
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Prerequisites
Remove / comment the RESEND_API_KEY from your environment since it would be taken as the default otherwise.
Steps to reproduce
Configure a custom SMTP relay with those environment variables (use your own SMTP server):
RELAY_SMTP_HOST="smtp-relay.example.com"
RELAY_SMTP_PORT="587"
RELAY_SMTP_USER="username"
RELAY_SMTP_PASS="password"
Start the application and use the continue with email option:

In the app logs, you will recognize an information text
[next] Using SMTP-Relay as mail service.as well as the correct mail service provider
And of course, the mail will be delivered.