Skip to content
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

feat: Add ability to get SmtpStream from SmtpTransport #64

Merged
merged 2 commits into from
Oct 14, 2024
Merged

feat: Add ability to get SmtpStream from SmtpTransport #64

merged 2 commits into from
Oct 14, 2024

Conversation

amaury1093
Copy link
Contributor

@amaury1093 amaury1093 commented Oct 13, 2024

I am the author of https://github.com/reacherhq/check-if-email-exists, and I currently use async-smtp 0.6. I would like to upgrade to 0.9, but I'm blocked on one small feature missing in this library.

The check-if-email-exists lib manually sends the EHLO, MAIL FROM, RCPT commands, but does not actually send the email. Looking at the SmtpClient, it only exposes the send() function, which does MAIL FROM, RCPT, DATA and sending. It seems like there's no way to have more granularity on the SMTP commands.

I would like to propose this small addition so that I can upgrade to 0.9 and continue using this great library without forking.

Thanks for considering.

src/smtp_client.rs Outdated Show resolved Hide resolved
@@ -123,6 +123,11 @@ impl<S: BufRead + Write + Unpin> SmtpTransport<S> {
Ok(transport)
}

/// Get the underlying SmtpStream.
pub fn get_stream(&mut self) -> &mut SmtpStream<S> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is usually named get_mut(), see for example https://docs.rs/tokio-rustls/latest/tokio_rustls/enum.TlsStream.html and https://docs.rs/tokio/latest/tokio/io/struct.BufWriter.html#method.get_mut

I would also provide get_ref() before it to get non-mutable reference, and maybe also into_inner() which is another common method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Added get_mut, get_ref and into_inner

@amaury1093 amaury1093 changed the title feat: Add ability to get SmtpStream from SmtpClient feat: Add ability to get SmtpStream from SmtpTransport Oct 14, 2024
@link2xt link2xt merged commit 7cc1026 into async-email:master Oct 14, 2024
11 checks passed
@link2xt
Copy link
Collaborator

link2xt commented Oct 14, 2024

Thanks!

@amaury1093 amaury1093 deleted the am/get-stream branch October 14, 2024 07:01
@amaury1093
Copy link
Contributor Author

Thanks! Any chance you can tag a 0.9.2?

@link2xt
Copy link
Collaborator

link2xt commented Oct 14, 2024

Just tagged and published

@amaury1093
Copy link
Contributor Author

Thanks @link2xt for your reactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants