diff --git a/src/lib.rs b/src/lib.rs index 4111da7..bd6bd3f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -75,16 +75,17 @@ where } else { "".to_owned() }; - let mut subject = if !service.is_empty() && service.to_lowercase() != "other" { + + let subject = if !service.is_empty() && service.to_lowercase() != "other" { format!("Mainmatter inquiry for {service}") } else { "Mainmatter inquiry".to_owned() }; - subject = if let Some(company) = payload.company { - format!("{} from {}", subject, company) + let name = if let Some(company) = payload.company { + format!("{} ({}) via mainmatter.com", payload.name, company) } else { - subject + format!("{} via mainmatter.com", payload.name) }; let data = json!({ @@ -96,7 +97,7 @@ where { "email": zapier_email } ] }], - "from": { "email": "no-reply@mainmatter.com", "name": format!("{} via mainmatter.com", payload.name) }, + "from": { "email": "no-reply@mainmatter.com", "name": name }, "reply_to": { "email": payload.email, "name": payload.name }, "subject": subject, "content": [{ diff --git a/tests/send_message.rs b/tests/send_message.rs index 05d409d..4054ab5 100644 --- a/tests/send_message.rs +++ b/tests/send_message.rs @@ -214,9 +214,9 @@ async fn it_adds_company_to_the_subject_if_one_is_provided() { { "email": "trigger@zapier.com" } ] }], - "from": { "email": "no-reply@mainmatter.com", "name": "name via mainmatter.com" }, + "from": { "email": "no-reply@mainmatter.com", "name": "name (Company) via mainmatter.com" }, "reply_to": { "email": "email@domain.tld", "name": "name" }, - "subject": "Mainmatter inquiry from Company", + "subject": "Mainmatter inquiry", "content": [{ "type": "text/plain", "value": "Hi!"