-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(email): Add SMTP support to allow mails through self hosted/cust…
…om SMTP server (#6617) Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
98aa84b
commit 0f563b0
Showing
11 changed files
with
670 additions
and
36 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -311,7 +311,7 @@ wildcard_origin = true | |
sender_email = "[email protected]" | ||
aws_region = "" | ||
allowed_unverified_days = 1 | ||
active_email_client = "SES" | ||
active_email_client = "NO_EMAIL_CLIENT" | ||
recon_recipient_email = "[email protected]" | ||
prod_intent_recipient_email = "[email protected]" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -676,7 +676,7 @@ connector_list = "cybersource" | |
sender_email = "[email protected]" # Sender email | ||
aws_region = "" # AWS region used by AWS SES | ||
allowed_unverified_days = 1 # Number of days the api calls ( with jwt token ) can be made without verifying the email | ||
active_email_client = "SES" # The currently active email client | ||
active_email_client = "NO_EMAIL_CLIENT" # The currently active email client | ||
recon_recipient_email = "[email protected]" # Recipient email for recon request email | ||
prod_intent_recipient_email = "[email protected]" # Recipient email for prod intent email | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use common_utils::{errors::CustomResult, pii}; | ||
use router_env::logger; | ||
|
||
use crate::email::{EmailClient, EmailError, EmailResult, IntermediateString}; | ||
|
||
/// Client when email support is disabled | ||
#[derive(Debug, Clone, Default, serde::Deserialize)] | ||
pub struct NoEmailClient {} | ||
|
||
impl NoEmailClient { | ||
/// Constructs a new client when email is disabled | ||
pub async fn create() -> Self { | ||
Self {} | ||
} | ||
} | ||
|
||
#[async_trait::async_trait] | ||
impl EmailClient for NoEmailClient { | ||
type RichText = String; | ||
fn convert_to_rich_text( | ||
&self, | ||
intermediate_string: IntermediateString, | ||
) -> CustomResult<Self::RichText, EmailError> { | ||
Ok(intermediate_string.into_inner()) | ||
} | ||
|
||
async fn send_email( | ||
&self, | ||
_recipient: pii::Email, | ||
_subject: String, | ||
_body: Self::RichText, | ||
_proxy_url: Option<&String>, | ||
) -> EmailResult<()> { | ||
logger::info!("Email not sent as email support is disabled, please enable any of the supported email clients to send emails"); | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.