I am attempting to move most of my daily working life to a terminal shell. I am a .NET dev so I run on WinXP purely for visual studio (just wait until I get better at Emacs). I would really mu开发者_如何学编程ch like it if I could use an email client within a terminal (either using Console or PowerShell within Console).
From my uni days I know of only pine and so this is what I tried to get for windows. However, I could only find two variants, PC-Pine and Alpine for Windows. Both of these provide the mail functions I want and they can connect to my domain exchange server BUT I cannot get them to launch with the shell I am using (Console with PowerShell).
My question: Is there anyone out there running Windows that uses a console mail client that can run in PowerShell or Console2 which has the same or similar functionality to Pine?
If you want to READ email from either the Windows CMD line or Powershell, your best bet it to try and get one of the UNIX-style Terminal email clients to work using CGYWIN as the front end. You might want to try MUTT or the Softabar CMD EMail Client but I haven't tried either one myself.
However, if all you want is SEND email, then that's easy :)
I use Powershell to send emails using the following snippit. This could very easily be put into a script or pasted into your $Profile file to allow you to send emails on the fly.
$emailFrom = "sender"
$emailTo = "recipient"
$subject = "Your subject"
$body = "Your Message"
$smtpServer = "smtp.server.com"
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $body)
You could even wrap this in a "Send-Mail" cmdlet and call it using the parameters whenever you want, for example Send-Mail("ivan@stackoverflow","dbarrett83@stackoverflow","I answered your question","Hey man, answered you question on SO...go check it out. 'n. Talk to you later - Dan")
. Just make sure to use 'n (the accent key under the tilde followed by the lowercase 'n') for line breaks.
I hope this helps!
~Dan
精彩评论