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

Unable to update Sender property #2797

Closed
soggycity opened this issue Oct 12, 2022 · 1 comment
Closed

Unable to update Sender property #2797

soggycity opened this issue Oct 12, 2022 · 1 comment

Comments

@soggycity
Copy link

The Sender property cannot be changed after it is set with the initial setFrom method. The code only updates Sender if it is empty.

The use case is opening a connection with a SMTP server and sending multiple emails using different sending accounts (user and password combinations) on the same server without having to close the connection.

Currently, the Reply-to gets the value from the first account and then cannot be updated for subsequent emails sent using different accounts. As a result, the only way to send emails from different accounts on the same server is to destroy the PHPMailer object and create a new one which means the connection to the SMTP server has to be closed and then opened again.

@Synchro
Copy link
Member

Synchro commented Oct 12, 2022

What's stopping you from setting the public Sender property? It's only set from setFrom() if you have not set it yourself. IME, most mail servers will not let you do this anyway, because the envelope from is usually tied to the authenticated user.

@Synchro Synchro closed this as completed Oct 12, 2022
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

No branches or pull requests

2 participants