Knowledge Seeker
Knowledge Seeker

Reputation: 566

Sending emails from multiple email addresses via one SMTP server

I want to send emails from multiple email addresses like [email protected], [email protected] via one smtp server that is against one email address. But when I do this I get following error:

raise SMTPAuthenticationError(code, resp) smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8  https://support.google.com/mail/?p=BadCredentials

My SMTP settings are:

export CR_AUTH_MAIL_SERVER=smtp.gmail.com
export CR_AUTH_MAIL_PORT=587
export [email protected]
export CR_AUTH_MAIL_PASSWORD=sampleForQuestion

If I use email address other than [email protected], it is giving me error.

Can I send emails from multiple valid email addresses by using one email adresses ? I'm always receiving emails from [email protected].

Upvotes: 0

Views: 821

Answers (1)

pulkit8
pulkit8

Reputation: 196

You are using gmail SMTP which only has your [email protected] email id as valid email id with its respective password.

You can't send mail using gmail SMTP from an email id that doesn't exist or you don't have its right credentials. You would need to sign up with those email ids also.

You can try using self hosted mailer for this purpose (i.e sending emails from different email ids but that isn't recommended and will fall into spam folders for being un-authenticated) Other quick solution would be to use some mail smtp providers like Mailgun, AWS SES etc. which will allow different "from" email ids.

Always test your mail score, in case sending marketing mail. This guide is quite helpful

Upvotes: 0

Related Questions