Msmtp, gmail and mailctl

I’m trying to get command line email working with msmtp and gmail. Msmtp works with basic smtp servers with plain login.

But gmail requires oauth2. For that we are supposed to use mailctl (installed as mailctl-bin from AUR).

I’ve installed mailctl but the install does not provide the basic config files (some templates exist but they are opaque to me as to how to set them up). Does anyone have mailctl working to provide gmail service for msmtp? If so, could you provide more instructions for setting it up?

Have you read the Arch Wiki page on msmtp? There is a section on OAuth2 Setup:

https://wiki.archlinux.org/title/msmtp

1 Like

yes; the msmtp config is clear, but what I don’t know is how to set up the mailctl config files (like ~/.config/mailctl/config.yaml, service.yaml etc?)

I have never used msmtp. On my RPi (running Debian 11) I installed mailutils and ssmtp and it was very easy to configure to work with Gmail - I only had to add a credentials to a single config file.

You are probably using app passwords and not OAuth2. (With Gmail, that’s especially stupid annoying to set up, instead use an app password.)

thanks mithrial - app password is the (very) simple answer. I did not see the option because 2 factor auth was not turned on my google account. Seems to work perfectly now.

(I would still kind of like to know how to use mailctl to do this however.)

I am using an app password, apologies for any confusion I caused.

I have been having a look at OAuth2 just now and as a scientist working in a hospital, it’s way out of my depth.

Have you fixed mailctl config? I have the same issue.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.