Re: using mutt with postfix and localhost:25
On 12Sep2021 15:17, Globe Trotter via Mutt-users wrote: >So, I do not know if I can do this, but I can send email by >specifically including the smtp with port 25. I dont really need it for >anything else. It is quite likely that I am not understanding the >import of your question. > >All I do is: > >sudo ssh -L 25:mailhub:25 username@your_server > >And then, configuring 'localhost' as my smtp server on port 25 gets my >mail sent directly forward through the SSH link. Ok, so you're running the ssh connection as root. That's usually a bad idea. The only reason you need to do that that I can see above is to bind to port 25 at the local end. I would recommend running your tunnel like this: ssh -L 1025:mailhub:25 username@your_server and configuring your mutt smtp_url to use port 1025 instead of 25. Others have made this same suggestion. IMO, it is also worth configuring your local postfix install, provided postfix is active locally. Particularly if this is your normal machine which you usually use - having a working local mail system is a good thing - lots of things send email, such as cron and at - they will all just start working if you set this up. This means that you can compose and "send" (well, queue) email locally when offline or when the ssh tunnel is not up. It will go out next time the tunnel's up. Then you just turn off the smtp_url setting and use the local sendmail command for delivery. That's what I do. Most of postfix's configuration is in the file /etc/postfix/main.cf In particular you want (taken from my own main.cf file here): relayhost = 127.0.0.2:1025 mydomain = cskk.id.au myorigin = cskk.id.au mydestination = $myhostname, localhost.$mydomain, localhost inet_interfaces = localhost mynetworks_style = host Obviously change: - cskk.id.au to your own domain - you want the local email system to send legitmate headers. - relayhost to be your ssh tunnel: localhost:1025 Relayhost is the upstream smarthost which accepts your email. It is the equivalent of the smtp_url in the mutt config, but having postfix do that bit. It can of course be an ISP etc; for example one of the (many) commented out ones I've got here is: ##relayhost = mail.optusnet.com.au which was there to deliver directly to a former ISP. My 127.0.0.2 is part of my local setup: I've got haproxy running there, to deliver to whatever upstream ISP is available - in my case the home server or an ssh tunnel to our cloud VM, both of which have their own postfix setups. Cheers, Cameron Simpson
Re: using mutt with postfix and localhost:25
* Ofer Inbar [2021-09-13 16:17]: > On Mon, Sep 13, 2021 at 08:33:43AM +0300, > Jean Louis wrote: > > > * Ofer Inbar [2021-09-13 02:15]: > > > > All I do is: > > > > > > > > sudo ssh -L 25:mailhub:25 username@your_server > > > > > > > > And then, configuring 'localhost' as my smtp server on port 25 > > > > gets my mail sent directly forward through the SSH link. > > I just want to clarify that this is mis-attributed. > I did not write that, the OP of this thread did. > -- Cos Sure. I agree on that, it was not well quoted but also not 100% bad as the number of > symbols designates also some previous quotations. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/
Re: using mutt with postfix and localhost:25
On Mon, Sep 13, 2021 at 08:33:43AM +0300, Jean Louis wrote: > * Ofer Inbar [2021-09-13 02:15]: > > > All I do is: > > > > > > sudo ssh -L 25:mailhub:25 username@your_server > > > > > > And then, configuring 'localhost' as my smtp server on port 25 > > > gets my mail sent directly forward through the SSH link. I just want to clarify that this is mis-attributed. I did not write that, the OP of this thread did. -- Cos
Re: using mutt with postfix and localhost:25
* Ofer Inbar [2021-09-13 02:15]: > > All I do is: > > > > sudo ssh -L 25:mailhub:25 username@your_server > > > > And then, configuring 'localhost' as my smtp server on port 25 > > gets my mail sent directly forward through the SSH link. I have just tried the method and mutt somehow got the certificate from port 25, I had to accept it (once) and then it started authenticating. >From Mutt manual: Since all protocols supported by Mutt support/require authentication, login credentials may be specified in the URL. This has the advantage that multiple IMAP, POP3 or SMTP servers may be specified (which isn't possible using, for example, $imap_user). The username may contain the "@" symbol being used by many mail systems as part of the login name. The special characters "/" (%2F), ":" (%3A) and "%" (%25) have to be URL-encoded in usernames using the %-notation. How I see that case of forwarding port 25 which is normally not used with authentication on localhost, is that you should better forward the other port like 587 which is normally used WITH authentication, and then use that port to submit emails. As the manual says "since all protocols supported by Mutt support/require authentication" -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/
Re: using mutt with postfix and localhost:25
On Sun, Sep 12, 2021 at 03:17:46PM +, Globe Trotter via Mutt-users wrote: > So, I do not know if I can do this, but I can send email by > specifically including the smtp with port 25. I dont really need it > for anything else. It is quite likely that I am not understanding the > import of your question. > > All I do is: > > sudo ssh -L 25:mailhub:25 username@your_server > > And then, configuring 'localhost' as my smtp server on port 25 gets my > mail sent directly forward through the SSH link. > > Thanks! Ah, it's making sense now. But is there a reason you need the ssh tunnel? Does it work if you set smtp_url=smtp://mailhub:25 instead? Don't get me wrong, I think there are never enough ssh tunnels in the world, but it might not be needed here. If the postfix server has TLS configured, and will accept the connection, mutt will take advantage of STARTTLS and the traffic will be encrypted. cheers, raf
Re: using mutt with postfix and localhost:25
> All I do is: > > sudo ssh -L 25:mailhub:25 username@your_server > > And then, configuring 'localhost' as my smtp server on port 25 gets my mail > sent directly forward through the SSH link. Ahh, you left out a key piece of information: Postfix is *not* running on your local host. Instead, you are setting up an ssh port forward to the mail server where postfix is running. Perhaps that server uses this as a form of authentication/security - if you have been instructed to do this by the admins, maybe they're using this as a way to allow people who have ssh login accounts (and thus the ability to create these ssh port tunnels) to submit mail as if it were submitted from the local host. Because of this unusual setup, you can't use mutt's default, because that would try to deliver mail using the mail server on your actual local host. So now your question makes sense. You need mutt to send mail via the ssh tunnel; you cannot submit it locally, because that remote server running postfix would never see it if you did so. -- Cos
Re: using mutt with postfix and localhost:25
On Sunday, September 12, 2021, 09:55:56 AM CDT, Jean Louis wrote: * Globe Trotter via Mutt-users [2021-09-12 17:47]: > Thank you for this. OK, so you are correct in that doing nothing > works on my office machine but not when I connect to it remotely to > deliver my mail using ssh -L etc and am using that server to deliver > my email. Good that you explained your method of the connection. And did you verify that you can reach localhost at port 25 with certainty? You can verify it by using `telnet': $ telnet localhost 25 and if there is banner then you have SMTP server forwarded to local host. Ports under 1024 can be forwarded only as `root' as they are considered privileged. If you cannot reach the port 25 on localhost try forwarding it to port 1025 and then dispatch to that port. -- Jean So, I do not know if I can do this, but I can send email by specifically including the smtp with port 25. I dont really need it for anything else. It is quite likely that I am not understanding the import of your question. All I do is: sudo ssh -L 25:mailhub:25 username@your_server And then, configuring 'localhost' as my smtp server on port 25 gets my mail sent directly forward through the SSH link. Thanks!
Re: using mutt with postfix and localhost:25
* Globe Trotter via Mutt-users [2021-09-12 17:47]: > Thank you for this. OK, so you are correct in that doing nothing > works on my office machine but not when I connect to it remotely to > deliver my mail using ssh -L etc and am using that server to deliver > my email. Good that you explained your method of the connection. And did you verify that you can reach localhost at port 25 with certainty? You can verify it by using `telnet': $ telnet localhost 25 and if there is banner then you have SMTP server forwarded to local host. Ports under 1024 can be forwarded only as `root' as they are considered privileged. If you cannot reach the port 25 on localhost try forwarding it to port 1025 and then dispatch to that port. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/
Re: using mutt with postfix and localhost:25
Thank you for this. OK, so you are correct in that doing nothing works on my office machine but not when I connect to it remotely to deliver my mail using ssh -L etc and am using that server to deliver my email. I am not able to find any notification as to what goes wrong beyond the fact that the mail does not get delivered. Hope this explains. Thanks! On Saturday, September 11, 2021, 07:48:52 PM CDT, raf wrote: On Sat, Sep 11, 2021 at 08:23:04AM -0700, Michael Slouber wrote: > On 09/11/21 01:24PM, Globe Trotter via Mutt-users wrote: > > Thanks very much! I am unable to send mail using postfix. However, > > the same setting makes it work for sylpheed when I simply specify > > localhost:25 in the SMTP server so I think that the postfix is set > > up all right, perhaps. If postfix is configured correctly, and mail submitted via localhost:25 does get delivered, then the default value for mutt's sendmail parameter should also work. What do you mean when you say you are unable to send mail using postfix? Sending mail using postfix means using a mail user agent like mutt which by default submits mail for delivery by invoking postfix's sendmail-compatible /usr/sbin/sendmail program to submit mail to postfix's mail queue, after which postfix will deliver it. What acually goes wrong when you try to send email from mutt with the default setting for the sendmail parameter? > This setting in Muttrc works for me: > > set smtp_url = "smtp://localhost:25" This is intended for using a remote smarthost to send mail through. It shouldn't be necessary for localhost. It works, but it's probably slightly slower because it has to perform the SMTP dialogue. If postfix can deliver mail submitted by mutt this way, it should also be able to deliver mail submitted by mutt the default way. cheers, raf
Re: using mutt with postfix and localhost:25
On Sat, Sep 11, 2021 at 08:23:04AM -0700, Michael Slouber wrote: > On 09/11/21 01:24PM, Globe Trotter via Mutt-users wrote: > > Thanks very much! I am unable to send mail using postfix. However, > > the same setting makes it work for sylpheed when I simply specify > > localhost:25 in the SMTP server so I think that the postfix is set > > up all right, perhaps. If postfix is configured correctly, and mail submitted via localhost:25 does get delivered, then the default value for mutt's sendmail parameter should also work. What do you mean when you say you are unable to send mail using postfix? Sending mail using postfix means using a mail user agent like mutt which by default submits mail for delivery by invoking postfix's sendmail-compatible /usr/sbin/sendmail program to submit mail to postfix's mail queue, after which postfix will deliver it. What acually goes wrong when you try to send email from mutt with the default setting for the sendmail parameter? > This setting in Muttrc works for me: > > set smtp_url = "smtp://localhost:25" This is intended for using a remote smarthost to send mail through. It shouldn't be necessary for localhost. It works, but it's probably slightly slower because it has to perform the SMTP dialogue. If postfix can deliver mail submitted by mutt this way, it should also be able to deliver mail submitted by mutt the default way. cheers, raf
Re: using mutt with postfix and localhost:25
And that does it, thank you!! On to the next task now. On Saturday, September 11, 2021, 10:30:47 AM CDT, Michael Slouber via Mutt-users wrote: On 09/11/21 01:24PM, Globe Trotter via Mutt-users wrote: > Thanks very much! I am unable to send mail using postfix. However, the same > setting makes it work for sylpheed when I simply specify localhost:25 in the > SMTP server so I think that the postfix is set up all right, perhaps. > > Is there a way to explicitly put localhost with port 25 in the send mail? > > Btw, I have not actually managed to set up two accounts with mutt, that is my > next target after resolving this. > > Thanks! > > > > > > > On Saturday, September 11, 2021, 02:24:52 AM CDT, raf wrote: > > > > > > On Sat, Sep 11, 2021 at 05:31:13AM +, Globe Trotter via Mutt-users > wrote: > > > > Hi, > > > > I have an account where I need to send email through localhost > > (with port 25). I am using postfix currently, but I do not know > > much. Anyway, on sylpheed, I used to say: localhost:25 as the SMTP > > server and life was good. So, my question is how do I set it up for > > this account to use SMTP server localhost:25? (The other accounts are > > personal and will use gmx, etc, SMTP settings). I have been using > > postfix because my work email uses postfix as given by my sysadmin (I > > think that it changes the relayhost name) and perhps the same can be > > done with something like msmtp but i do not know. > > > > Thanks! > > > The typical way to submit mail locally is via > /usr/sbin/sendmail. That's the default in mutt (and > probably all other MUAs). The explicit default is: > > set sendmail="/usr/sbin/sendmail -oem -oi" > > You shouldn't have to do anything to make this happen. > It's the default. > > Technically, postfix's sendmail binary doesn't use SMTP > (it runs postdrop to add the message to postfix's mail > queue) but that shouldn't matter. It's functionally > equivalent to using SMTP on localhost:25, so you > shouldn't need to care. > > But, if you really have a reason to avoid the default, > more efficient, already working thing, and make > absolutely sure that you are directly connecting to > localhost:25, you should search for a different > sendmail-compatible program that does SMTP to > localhost:25, install it, and then set mutt's sendmail > variable to refer to that: > > In ~/.muttrc: > set sendmail="/path/to/other/sendmail -oem -oi" > > But it sounds very much as though you really don't need > to do this. It sounds like you just need the local mail > server to deliver mail sent from mutt, and if you have > postfix installed locally and configured OK, that will > just happen. > > cheers, > raf > This setting in Muttrc works for me: set smtp_url = "smtp://localhost:25"
Re: using mutt with postfix and localhost:25
On 09/11/21 01:24PM, Globe Trotter via Mutt-users wrote: > Thanks very much! I am unable to send mail using postfix. However, the same > setting makes it work for sylpheed when I simply specify localhost:25 in the > SMTP server so I think that the postfix is set up all right, perhaps. > > Is there a way to explicitly put localhost with port 25 in the send mail? > > Btw, I have not actually managed to set up two accounts with mutt, that is my > next target after resolving this. > > Thanks! > > > > > > > On Saturday, September 11, 2021, 02:24:52 AM CDT, raf wrote: > > > > > > On Sat, Sep 11, 2021 at 05:31:13AM +, Globe Trotter via Mutt-users > wrote: > > > > Hi, > > > > I have an account where I need to send email through localhost > > (with port 25). I am using postfix currently, but I do not know > > much. Anyway, on sylpheed, I used to say: localhost:25 as the SMTP > > server and life was good. So, my question is how do I set it up for > > this account to use SMTP server localhost:25? (The other accounts are > > personal and will use gmx, etc, SMTP settings). I have been using > > postfix because my work email uses postfix as given by my sysadmin (I > > think that it changes the relayhost name) and perhps the same can be > > done with something like msmtp but i do not know. > > > > Thanks! > > > The typical way to submit mail locally is via > /usr/sbin/sendmail. That's the default in mutt (and > probably all other MUAs). The explicit default is: > > set sendmail="/usr/sbin/sendmail -oem -oi" > > You shouldn't have to do anything to make this happen. > It's the default. > > Technically, postfix's sendmail binary doesn't use SMTP > (it runs postdrop to add the message to postfix's mail > queue) but that shouldn't matter. It's functionally > equivalent to using SMTP on localhost:25, so you > shouldn't need to care. > > But, if you really have a reason to avoid the default, > more efficient, already working thing, and make > absolutely sure that you are directly connecting to > localhost:25, you should search for a different > sendmail-compatible program that does SMTP to > localhost:25, install it, and then set mutt's sendmail > variable to refer to that: > > In ~/.muttrc: > set sendmail="/path/to/other/sendmail -oem -oi" > > But it sounds very much as though you really don't need > to do this. It sounds like you just need the local mail > server to deliver mail sent from mutt, and if you have > postfix installed locally and configured OK, that will > just happen. > > cheers, > raf > This setting in Muttrc works for me: set smtp_url = "smtp://localhost:25"
Re: using mutt with postfix and localhost:25
Thanks very much! I am unable to send mail using postfix. However, the same setting makes it work for sylpheed when I simply specify localhost:25 in the SMTP server so I think that the postfix is set up all right, perhaps. Is there a way to explicitly put localhost with port 25 in the send mail? Btw, I have not actually managed to set up two accounts with mutt, that is my next target after resolving this. Thanks! On Saturday, September 11, 2021, 02:24:52 AM CDT, raf wrote: On Sat, Sep 11, 2021 at 05:31:13AM +, Globe Trotter via Mutt-users wrote: > Hi, > > I have an account where I need to send email through localhost > (with port 25). I am using postfix currently, but I do not know > much. Anyway, on sylpheed, I used to say: localhost:25 as the SMTP > server and life was good. So, my question is how do I set it up for > this account to use SMTP server localhost:25? (The other accounts are > personal and will use gmx, etc, SMTP settings). I have been using > postfix because my work email uses postfix as given by my sysadmin (I > think that it changes the relayhost name) and perhps the same can be > done with something like msmtp but i do not know. > > Thanks! The typical way to submit mail locally is via /usr/sbin/sendmail. That's the default in mutt (and probably all other MUAs). The explicit default is: set sendmail="/usr/sbin/sendmail -oem -oi" You shouldn't have to do anything to make this happen. It's the default. Technically, postfix's sendmail binary doesn't use SMTP (it runs postdrop to add the message to postfix's mail queue) but that shouldn't matter. It's functionally equivalent to using SMTP on localhost:25, so you shouldn't need to care. But, if you really have a reason to avoid the default, more efficient, already working thing, and make absolutely sure that you are directly connecting to localhost:25, you should search for a different sendmail-compatible program that does SMTP to localhost:25, install it, and then set mutt's sendmail variable to refer to that: In ~/.muttrc: set sendmail="/path/to/other/sendmail -oem -oi" But it sounds very much as though you really don't need to do this. It sounds like you just need the local mail server to deliver mail sent from mutt, and if you have postfix installed locally and configured OK, that will just happen. cheers, raf
Re: using mutt with postfix and localhost:25
On Sat, Sep 11, 2021 at 05:24:21PM +1000, raf wrote: > On Sat, Sep 11, 2021 at 05:31:13AM +, Globe Trotter via Mutt-users > wrote: > > > Hi, > > > > I have an account where I need to send email through localhost > > (with port 25). I am using postfix currently, but I do not know > > much. Anyway, on sylpheed, I used to say: localhost:25 as the SMTP > > server and life was good. So, my question is how do I set it up for > > this account to use SMTP server localhost:25? (The other accounts are > > personal and will use gmx, etc, SMTP settings). I have been using > > postfix because my work email uses postfix as given by my sysadmin (I > > think that it changes the relayhost name) and perhps the same can be > > done with something like msmtp but i do not know. > > > > Thanks! > > The typical way to submit mail locally is via > /usr/sbin/sendmail. That's the default in mutt (and > probably all other MUAs). The explicit default is: > > set sendmail="/usr/sbin/sendmail -oem -oi" > > You shouldn't have to do anything to make this happen. > It's the default. > That's how I run mutt with postfix on my xubuntu system. -- Chris Green
Re: using mutt with postfix and localhost:25
On Sat, Sep 11, 2021 at 05:24:21PM +1000, raf wrote: > On Sat, Sep 11, 2021 at 05:31:13AM +, Globe Trotter via Mutt-users > wrote: > > > Hi, > > > > I have an account where I need to send email through localhost > > (with port 25). I am using postfix currently, but I do not know > > much. Anyway, on sylpheed, I used to say: localhost:25 as the SMTP > > server and life was good. So, my question is how do I set it up for > > this account to use SMTP server localhost:25? (The other accounts are > > personal and will use gmx, etc, SMTP settings). I have been using > > postfix because my work email uses postfix as given by my sysadmin (I > > think that it changes the relayhost name) and perhps the same can be > > done with something like msmtp but i do not know. > > > > Thanks! > > The typical way to submit mail locally is via > /usr/sbin/sendmail. That's the default in mutt (and > probably all other MUAs). The explicit default is: > > set sendmail="/usr/sbin/sendmail -oem -oi" > > You shouldn't have to do anything to make this happen. > It's the default. > > Technically, postfix's sendmail binary doesn't use SMTP > (it runs postdrop to add the message to postfix's mail > queue) but that shouldn't matter. It's functionally > equivalent to using SMTP on localhost:25, so you > shouldn't need to care. > > But, if you really have a reason to avoid the default, > more efficient, already working thing, and make > absolutely sure that you are directly connecting to > localhost:25, you should search for a different > sendmail-compatible program that does SMTP to > localhost:25, install it, and then set mutt's sendmail > variable to refer to that: > > In ~/.muttrc: > set sendmail="/path/to/other/sendmail -oem -oi" > > But it sounds very much as though you really don't need > to do this. It sounds like you just need the local mail > server to deliver mail sent from mutt, and if you have > postfix installed locally and configured OK, that will > just happen. > > cheers, > raf I've probably misunderstood what you are asking. If you have mutt configured for using different accounts, and already have it set up to change hwo it sends mail depending on which account you are looking at, just configure it to use the default sendmail setting above for the account that requires local delivery. If I've still misunderstood, maybe you could show how you are currently configuring mutt to use gmx's SMTP server etc. for the other accounts. cheers, raf
Re: using mutt with postfix and localhost:25
On Sat, Sep 11, 2021 at 05:31:13AM +, Globe Trotter via Mutt-users wrote: > Hi, > > I have an account where I need to send email through localhost > (with port 25). I am using postfix currently, but I do not know > much. Anyway, on sylpheed, I used to say: localhost:25 as the SMTP > server and life was good. So, my question is how do I set it up for > this account to use SMTP server localhost:25? (The other accounts are > personal and will use gmx, etc, SMTP settings). I have been using > postfix because my work email uses postfix as given by my sysadmin (I > think that it changes the relayhost name) and perhps the same can be > done with something like msmtp but i do not know. > > Thanks! The typical way to submit mail locally is via /usr/sbin/sendmail. That's the default in mutt (and probably all other MUAs). The explicit default is: set sendmail="/usr/sbin/sendmail -oem -oi" You shouldn't have to do anything to make this happen. It's the default. Technically, postfix's sendmail binary doesn't use SMTP (it runs postdrop to add the message to postfix's mail queue) but that shouldn't matter. It's functionally equivalent to using SMTP on localhost:25, so you shouldn't need to care. But, if you really have a reason to avoid the default, more efficient, already working thing, and make absolutely sure that you are directly connecting to localhost:25, you should search for a different sendmail-compatible program that does SMTP to localhost:25, install it, and then set mutt's sendmail variable to refer to that: In ~/.muttrc: set sendmail="/path/to/other/sendmail -oem -oi" But it sounds very much as though you really don't need to do this. It sounds like you just need the local mail server to deliver mail sent from mutt, and if you have postfix installed locally and configured OK, that will just happen. cheers, raf
using mutt with postfix and localhost:25
Hi, I have an account where I need to send email through localhost (with port 25). I am using postfix currently, but I do not know much. Anyway, on sylpheed, I used to say: localhost:25 as the SMTP server and life was good. So, my question is how do I set it up for this account to use SMTP server localhost:25? (The other accounts are personal and will use gmx, etc, SMTP settings). I have been using postfix because my work email uses postfix as given by my sysadmin (I think that it changes the relayhost name) and perhps the same can be done with something like msmtp but i do not know. Thanks!