18
How send emails trough CLI (Windows) ?
(programming.dev)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
Is there a reason not to use PowerShell?
yes, it's been years that I'm using
CMD
and as I'm planning get rid of windows there is no point for me to learn it.I don't think you need to learn it, you just need to use one command. Even from a CMD prompt you can invoke powershell and a powershell cmdlet in a one-liner:
powershell send-mailmessage -from "me@somedomain.co.uk" -To "me@someotherdomain.co.uk" -subject "Test to me" -smtpserver My.Mail.Server.co.uk
True, you're certainly not forced to learn PowerShell if you're about to switch to Linux.
That said, PowerShell is my preferred shell on Linux.
PowerShell is open source, works great on Linux, and is even one of the pre-installed shells on Ubuntu.
And yes, I'm not sure what to think of all that, either. It's weird. It's also really useful.
Are you also managing AD or other services in Linux to make PS more viable, or just in general?
I'm not doing anything particularly specific to PowerShell - I just like the web-request module, and excellent JSON handler, because I do a decent amount of web API stuff from the command line.
I could curl+awk+sed this stuff, but the equivalent PowerShell is so much faster to write, and more concise to maintain than i.e. my zshell solution would be.
Even in a few places where I'm using zsh as my term, I'll still call into PowerShell if I already have a nice piece of PowerShell that does what I need. The two interoperate well, but I lose the object oriented pipe once the data is back in Zsh, of course.