Skip to content

email: Change from to crates.io <no-reply@crates.io> #9342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/email.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use lettre::transport::file::FileTransport;
use lettre::transport::smtp::authentication::{Credentials, Mechanism};
use lettre::transport::smtp::SmtpTransport;
use lettre::transport::stub::StubTransport;
use lettre::{Message, Transport};
use lettre::{Address, Message, Transport};
use rand::distributions::{Alphanumeric, DistString};

pub trait Email {
Expand All @@ -19,7 +19,7 @@ pub trait Email {
pub struct Emails {
backend: EmailBackend,
pub domain: String,
from: Mailbox,
from: Address,
}

const DEFAULT_FROM: &str = "noreply@crates.io";
Expand Down Expand Up @@ -97,13 +97,15 @@ impl Emails {
self.domain,
);

let from = Mailbox::new(Some(self.domain.clone()), self.from.clone());

let subject = email.subject();
let body = email.body();

let email = Message::builder()
.message_id(Some(message_id.clone()))
.to(recipient.parse()?)
.from(self.from.clone())
.from(from)
.subject(subject)
.header(ContentType::TEXT_PLAIN)
.body(body)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: src/tests/routes/me/tokens/create.rs
expression: app.emails_snapshot()
---
To: foo@example.com
From: noreply@crates.io
From: crates.io <noreply@crates.io>
Subject: crates.io: New API token "bar" created
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: src/tests/routes/me/tokens/create.rs
expression: app.emails_snapshot()
---
To: foo@example.com
From: noreply@crates.io
From: crates.io <noreply@crates.io>
Subject: crates.io: New API token "bar" created
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: src/tests/routes/me/tokens/create.rs
expression: app.emails_snapshot()
---
To: foo@example.com
From: noreply@crates.io
From: crates.io <noreply@crates.io>
Subject: crates.io: New API token "bar" created
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: src/tests/routes/me/tokens/create.rs
expression: app.emails_snapshot()
---
To: foo@example.com
From: noreply@crates.io
From: crates.io <noreply@crates.io>
Subject: crates.io: New API token "bar" created
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: src/tests/github_secret_scanning.rs
expression: app.emails_snapshot()
---
To: foo@example.com
From: noreply@crates.io
From: crates.io <noreply@crates.io>
Subject: crates.io: Your API token "bar" has been revoked
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: src/tests/owners.rs
expression: app.emails_snapshot()
---
To: user2@example.com
From: noreply@crates.io
From: crates.io <noreply@crates.io>
Subject: crates.io: Ownership invitation for "owners_multiple"
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Expand All @@ -17,7 +17,7 @@ wnership invitations.
----------------------------------------

To: user3@example.com
From: noreply@crates.io
From: crates.io <noreply@crates.io>
Subject: crates.io: Ownership invitation for "owners_multiple"
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Expand All @@ -31,7 +31,7 @@ wnership invitations.
----------------------------------------

To: user2@example.com
From: noreply@crates.io
From: crates.io <noreply@crates.io>
Subject: crates.io: Ownership invitation for "owners_multiple"
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Expand All @@ -45,7 +45,7 @@ wnership invitations.
----------------------------------------

To: user3@example.com
From: noreply@crates.io
From: crates.io <noreply@crates.io>
Subject: crates.io: Ownership invitation for "owners_multiple"
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Expand Down
4 changes: 2 additions & 2 deletions src/tests/snapshots/all__owners__modify_multiple_owners.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: src/tests/owners.rs
expression: app.emails_snapshot()
---
To: user2@example.com
From: noreply@crates.io
From: crates.io <noreply@crates.io>
Subject: crates.io: Ownership invitation for "owners_multiple"
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Expand All @@ -17,7 +17,7 @@ wnership invitations.
----------------------------------------

To: user3@example.com
From: noreply@crates.io
From: crates.io <noreply@crates.io>
Subject: crates.io: Ownership invitation for "owners_multiple"
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Expand Down
2 changes: 1 addition & 1 deletion src/tests/snapshots/all__owners__new_crate_owner.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: src/tests/owners.rs
expression: app.emails_snapshot()
---
To: Bar@example.com
From: noreply@crates.io
From: crates.io <noreply@crates.io>
Subject: crates.io: Ownership invitation for "foo_owner"
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: src/tests/worker/sync_admins.rs
expression: app.emails_snapshot()
---
To: existing-admin@crates.io
From: noreply@crates.io
From: crates.io <noreply@crates.io>
Subject: crates.io: Admin account changes
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Expand All @@ -18,7 +18,7 @@ Revoked admin access:
----------------------------------------

To: obsolete-admin@crates.io
From: noreply@crates.io
From: crates.io <noreply@crates.io>
Subject: crates.io: Admin account changes
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Expand Down