decke / smtprelay

Simple Golang SMTP relay/proxy server
MIT License
459 stars 110 forks source link

Remotes Auth Account Replace My From Account #147

Closed nonbutAworker closed 9 months ago

nonbutAworker commented 9 months ago

Hi, thank for you repo !

If I send email From A@test.com To B@test.com, but I configure C@test.com as auth account in smtprelay.ini file like this:

; GMail
remotes = starttls://C@test.com:xxx@smtp.gmail.com:587

Then I login in B@test.com account and find out the sender is C@test.com instead of REAL sender A@test.com as expected How Can I fix this as expected, any help would be appreciated !

decke commented 9 months ago

This is expected behavior and what most mail services do. If you look at the headers of the email you will see that the mail was send from A@test.com but since you authenticated with C@test.com GMail automatically rewrites the mail headers accordingly. It is the price we have to pay for fighting spam.

nonbutAworker commented 9 months ago

Thanks very much ! what you mean is who changed the from address is GMail instead of this repo? which means If I found another smtp server as my next deliver that didn't change the from address, I can get what I want?

decke commented 9 months ago

I do not use GMail myself anymore so I cannot easily test it but I used it in the past and the behavior was easy to understand when looking at the full mail headers. Google SMTP servers preserve some headers so you will still see A@test.com somewhere but it also rewrites some parts of it to match with the email address you use for authentication.

If you can post a full mail including headers that would help a lot to explain it.