sending / receiving emails via command line


  1. Posts : 11,247
    Windows / Linux : Arch Linux
       #1

    sending / receiving emails via command line


    Hi folks
    I'm working on trying to send and receive emails via command line every so often on Windows

    It can be done but all the faqs - imbeciles guides etc etc just seem too complex and everybody uses gmail as their mail server.

    I'll do a proper tutorial later for a complete method but just to start on receive emails from a single account into one mailbox on an IMAP server (bog standard, no SLS etc) it's very simple to start receiving.

    ON Windows you need to install cygwin and mutt.

    now simply create the following in file .muttrc

    set mbox_type = Maildir
    set folder = imap://<your imap mail server address>
    set imap_user = <your account to RECEIVE mail>
    set imap_pass = <password on the account for inbound mail>
    set spoolfile = "+INBOX"

    That's it for Inbound mail

    I'll do more complex stuff later also with smtp send and with TLS stuff (If your IMAP has a security type sign on then you need imaps: for the server not imap: for the inbound server.

    The way I like to try stuff is forget all the complex stuff --try the bog standard easiest possible things first so the process (send / receive) works and then enhance security, add accounts etc etc.

    what I'm trying to achieve is to automatically send email containing my IP address (ISP one not LAN) when it changes so I can always logon remotely to my computers at home without needing teamviewer / dyndns or whatever.

    Basic receive now works : just type mutt and you'll see the screen I've got. BTW you can do this from the WSL without needing cygwin -- install mutt of course output shown below.

    Note there's also an error in most guides I've looked at -- IMAP password -- correct parameter should be as I've got it -- imap_pass and NOT imap_password.


    sending / receiving emails via command line-screenshot_20191223_130208.png

    cheers
    jimbo
      My Computer


  2. Posts : 1,680
    X
       #2

    Do you use the Linux subsystem?

    If so use command line capabilities in Linux.
    You'll find plenty of good advice online for command-line email ... and command-line everything else, too.

    Linux users are command-line users. They do. They know. They're the go-to best bet.
      My Computer


  3. Posts : 11,247
    Windows / Linux : Arch Linux
    Thread Starter
       #3

    margrave55 said:
    Do you use the Linux subsystem?

    If so use command line capabilities in Linux.
    You'll find plenty of good advice online for command-line email ... and command-line everything else, too.

    Linux users are command-line users. They do. They know. They're the go-to best bet.

    Hi there
    @margrave55 works fine on WSL.


    easy via netcat

    Had it with teamviewer - how to make them unnecessary

    if you copy the text from (Windows Forum) get it into unix format ( install package dos2unix) and simply run dos2unix <filename>

    Works a treat -- no mail servers or anything needed --if you need auth servers / ssl / tls I need to modify the script but the base works fine on a normal ISP mail server on port 25
    crontab this so it sends email every so often and then wag 2 fingers at Teamviewer !!!!!

    Cheers
    jimbo
      My Computer


  4. Posts : 5,330
    Windows 11 Pro 64-bit
       #4

    You can use Telnet command-line to send and view emails.

    Sending or viewing emails using telnet - Media Temple
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 10:51.
Find Us




Windows 10 Forums