Go and Microsoft Outlook

2,137 views
Skip to first unread message

Andrew

unread,
Feb 16, 2019, 2:40:52 AM2/16/19
to golang-nuts
Our corporate using Outlook send/receive emails. I have some emails need to send out routinely with the same content(book truck, ask for order information, etc).
I want to write a simple web app with some buttons on the page(Book Truck, for example), when I click the button, I want to send the email automatically.
I know there's Microsoft Graph API which can do the job, but there's no official Go client library for it.

Is it possible to send email using Go and Outlook?

Thanks,
Andrew

Lucio

unread,
Feb 16, 2019, 7:05:29 AM2/16/19
to golang-nuts


On Saturday, 16 February 2019 09:40:52 UTC+2, Andrew wrote:

Is it possible to send email using Go and Outlook?

If you need some special features provided exclusively by Outlook, then I think you'll need to search carefully and may not find what you want, thus needing to concoct it yourself.

If all you need is an SMTP client to speak RFC-5321 even to an Exchange server, then everything you require can be found in the "net/mail" package of the Go standard library.

Lucio.

Andrew

unread,
Feb 16, 2019, 2:53:15 PM2/16/19
to golang-nuts
Thanks, Can you please show me the example code?

I've tried the code below by using my outlook account but get errors:

2019/02/16 11:51:24 504 5.7.4 Unrecognized authentication type [MWHPR13CA0009.namprd13.prod.outlook.com]
panic: 504 5.7.4 Unrecognized authentication type [MWHPR13CA0009.namprd13.prod.outlook.com]

minf...@arcor.de

unread,
Feb 16, 2019, 3:44:55 PM2/16/19
to golang-nuts
Only if golang is a panacea to you. I'd use AutoIT perhaps...

Wojciech S. Czarnecki

unread,
Feb 17, 2019, 3:41:33 PM2/17/19
to golan...@googlegroups.com
On Sat, 16 Feb 2019 11:53:14 -0800 (PST)
Andrew <angan...@gmail.com> wrote:

> 2019/02/16 11:51:24 504 5.7.4 Unrecognized authentication type
Log says everything in plain words. Your (MS) exchange account is
not configured to use plaintext passwords (as it certainly should not be).

>:auth := smtp.PlainAuth("","user...@example.tld", "password", host)
You need to use smtp auth that is supported on your smtp account.
Talk to your admin, likely CRAMMD5[1] will be avaliable.

[1] https://godoc.org/net/smtp#CRAMMD5Auth

Hope this helps,

--
Wojciech S. Czarnecki
<< ^oo^ >> OHIR-RIPE
Reply all
Reply to author
Forward
0 new messages