2

I've only ever used GUI mail clients like Thunderbird, and want to try using offlineimap with alpine. However I'm confused about how it all ties together.

As I understand it:

Once I configure offlineimap with my accounts, it will go to every respective server and use IMAP to mirror my mails to a local folder like ~/mail/gmail. Presumably I can then use any mail client to read these emails, and if I make changes to them (such as marking as read or moving between folders) they will be pushed to the server the next time offlineimap syncs.

But what about sending mail? I'm a bit fuzzy on how email works, however, it seems like:

IMAP is just for downloading/uploading mail to be stored on my mail provider's server. So IMAP can't actually send mail. Mail is sent using SMTP. In many clients, when you click "send mail", what actually happens is that the mail you compose gets sent through SMTP and also the mail client saves a copy of the mail to the "sent" folder of your account, which will be propagated through IMAP.

So my questions here are:

  1. Is my understanding above correct?
  2. If I use offlineimap, who will actually send my outgoing mails through SMTP? Would I set up some separate "send emails" program that will periodically check my "outgoing" folder and send everything in there via SMTP (how will it know which SMTP server and account to use)? Or will I still have to set up SMTP server/credentials in alpine?

1 Answer 1

3

Yes, IMAP is a protocol to access the contents of a mailbox that is stored on another machine, it has nothing to do with email sending, routing and delivery itself.

SMTP is the protocol to send emails over the network.

To send emails, you submit them either to your local mail server on your machine provided there is one and it is properly configured to accept and route emails, which in that case can be done over SMTP or using the sendmail command, or to another mail server over the network.

You could configure your local mail server (exim, postfix...) to send email directly to recipients, but these days, those emails you send would likely be regarded by recipient servers as spam especially if your own address is from a domain that is that of a known email provider so is not recommended.

If you're accessing your mailbox over IMAP, as opposed to accessing a local mailbox on your machine where mail is delivered by the local mail server, that would suggest your email is handled by some third party mail provider. Beside imap access, those email providers would also supply the address of a server to which you can submit emails after having authenticated.

You could in theory configure your local mail server so it relays emails to external recipients via that provider's smtp server, using your own credentials for all the users on your system, but you can probably tell that sounds like a bad idea, if only from an accountability point of view.

Better would be for each user on your system to configure their mail user agent (their mail client application whether it's thunderbird, evolution or mutt/pine/mailx...) to submit all emails directly to their mail provider each with their own credentials there.

You'll want to make sure encryption is enabled. Generally, such email submission is done over SMTP but using port 587 (the corresponding service is called submission) instead of 25 which is rather reserved for mail relay, and encryption is enabled by using the STARTTLS SMTP command. It's also generally possible to contact a mail submission server directly over TLS on TCP port 465 (smtps).

Each MUA will have its own way to configure mail sending. For instance, with mutt, you could add:

set smtp_url="smtps://user:[email protected]"

Or:

set smtp_url="smtp://user:[email protected]:587"

(and make sure ssl_force_tls and ssl_starttls are set to yes as should be the default).

to your ~/.muttrc (or more safely configure it to get the password from some safe password vault).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .