Skip to content

Commit

Permalink
fix: ack mail
Browse files Browse the repository at this point in the history
  • Loading branch information
Bisht13 committed Jun 13, 2024
1 parent cf2d050 commit 3d34036
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/relayer/src/modules/web_server/rest_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,15 @@ pub async fn delete_safe_owner_api_fn(payload: String) -> Result<()> {
}

pub async fn receive_email_api_fn(email: String) -> Result<()> {
let parsed_email = ParsedEmail::new_from_raw_email(&email).await.unwrap();
let from_addr = parsed_email.get_from_addr().unwrap();
handle_email_event(EmailWalletEvent::Ack {
email_addr: from_addr.clone(),
subject: parsed_email.get_subject_all().unwrap_or_default(),
original_message_id: parsed_email.get_message_id().ok(),
})
.await
.unwrap();
tokio::spawn(async move {
match handle_email(email.clone()).await {
Ok(event) => match handle_email_event(event).await {
Expand All @@ -330,8 +339,6 @@ pub async fn receive_email_api_fn(email: String) -> Result<()> {
},
Err(e) => {
error!(LOG, "Error handling email: {:?}", e);
let parsed_email = ParsedEmail::new_from_raw_email(&email).await.unwrap();
let from_addr = parsed_email.get_from_addr().unwrap();
match handle_email_event(EmailWalletEvent::Error {
email_addr: from_addr,
error: e.to_string(),
Expand Down

0 comments on commit 3d34036

Please sign in to comment.