If you are using Google's SMTP servers, then it validates the From: header 
and restricts it to those which you have registered against that account.

You can register additional addresses (including non-Google ones):  
Settings > See all settings > Accounts and Import > Send Mail As (Use Gmail 
to send from your other email addresses) > Add another email address

It will send a verification mail so that you can prove you own that E-mail 
address.


On Thursday, 9 September 2021 at 22:03:32 UTC+1 dean.w....@gmail.com wrote:

> It could be that I'm not using smtp.SendMail() correctly, which is why I 
> posted it here.  Thanks for your guess, though.
>
> On Thursday, September 9, 2021 at 2:31:11 PM UTC-6 rol...@gmail.com wrote:
>
>> Hello,
>>
>> Am Do., 9. Sept. 2021 um 20:19 Uhr schrieb Dean Schulze <
>> dean.w....@gmail.com>:
>>
>>> I'm sending emails with smtp.SendMail() via gmail.  I set the from 
>>> argument to smtp.SendMail() to a different email address than my gmail 
>>> username, but the emails still get sent with the From: as my gmail address.
>>>
>>> Do I need to do something else to change the From: in the emails, or is 
>>> gmail always going to use my gmail address?
>>>
>>> I guess gmail uses the address bound to the used account, which would be 
>> in my opinion quite reasonable behavior.
>>
>> BTW this question is a bit OT here since not related to Go rather than 
>> mailing policy of Google accounts.
>>
>> BR,
>> Roland
>>
>> Thanks.
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "golang-nuts" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to golang-nuts...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/golang-nuts/04eb41bd-9002-443b-8921-c3ddcd833c87n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/golang-nuts/04eb41bd-9002-443b-8921-c3ddcd833c87n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/542dd81b-2cad-4d5f-8f46-c308302a3c1en%40googlegroups.com.

Reply via email to