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 much 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
Related
I know that technically, this question should be asked on phpStorm's forums, but being a popular IDE (I bet an eventual solution would also work for other popular IDEs from JetBrains), I'm thinking:
someone on SO might know and share the answer (faster than I'd get it from vendor)
the question answer might be useful and valuable to other coders (for that matter, even if I shall need to go on the vendor's forum I will get back with the answer here, when I find it)
If there is any need of context: I accidentally switched the connection type of a saved connection from ftp to local folder and when I switched back, the saved credentials were gone.
The question: Can I retrieve the saved password...
Angle 1: ...from this computer?
Angle 2: ...from another computer that has the same credentials saved, which I could access via TeamViewer, but has the password ●●●●●●(hidden)?
Edit: This method can only be used in the version of 2016.1 or before. For newer version (probably 2016.2), they changed the encode method. There is no clue for me to decode it.
Open C:\Users\.WebIde100\config\options\webServers.xml
Find your FTP and get the encrypted password from the password attribute.
Decrypt the password. I have written a PHP script to decrypt the string:
$pwd = "Your encrypted password here.";
$decrypted = '';
while (strlen($pwd) > 0) {
$decrypted .= chr(hexdec(substr($pwd, 0, 4)) ^ hexdec('dfaa'));
$pwd = substr($pwd, 4, strlen($pwd) - 1);
}
echo $decrypted;
If you trust my tools, you can use https://louislam.net/phpstorm-decrypt-password
If you use KeePass database file to store passwords, you can easely set password for that file, save and then open in KeePass manager, or migrate to other PHPStorm.
Go to Settings/Preferences | Appearance & Behavior | System Settings
| Passwords, enter new master password and save.
Open /.PhpStorm2017.1/config/c.kdbx (in "Keepass 2" or "Keeweb") with saved master password.
Here it is!
See answer here
Retrieve saved (hidden) SSH password from PhpStorm 2017.1
One way that just worked for me was to install Wireshark.
Use a capture filter of 'ftp', and do a "Test connection" inside PHPStorm.
Now stop the capture and examine what you've sniffed. The password will be in there.
I know this is a 1 year old question, but for everyone else, you can try to copy the selected (hidden) password with CTRL+C, and paste it in a text document (tested with 2016.3 on Debian).
For OSX users
Open keychain -> select the System Roots keychain (on the left side) -> search for IntelliJ.
If you click it you will see the ftp-username in the "Account" field. You can also use right click on the records to copy the password.
My question is in regards to how I should go about implementing a batch script/PowerShell cmdlet on Windows that does the following:
When a browser window is open that has the window/page title "Blank" then send the "tab" key, send login credentials to text boxes on webpage and then send the "enter" key.
I found this article (Automatic login to a website on windows 7/Chrome via batch file) about sending login credentials in a web browser, which is very similar to what I want to do, however I want the script to ONLY run if the browser is already open and has a specific value in the window title. This is for an authentication system for the network running on my server that asks me to re-login every 30 days, and will open up a browser window automatically when it needs me to login. So, when it opens the window, I want the script to be able to automatically login for me. Since the server is unattended (GUI wise), I want the re-authentication to occur automatically. My plan would be to have this set as a scheduled task and have it run nightly, to verify that the system is still authenticated. If the system is not authenticated, I want the batch file/cmdlet to login for me.
I did some research and found information about using conditions for batch files, but I couldn't find any information about how I would use the window title or any other program attribute to base my conditional off of.
People have suggested using PowerShell, so I am totally open to that as well if you have a recommendation for implementation via that route.
Please let me know if you need any further information, or have any questions.
You can do it with Powershell.
Here is an example for getting the window name, it should be possible to use it to detect Internet explorer to.
$selectedWindows = get-process | Where-Object { $_.MainWindowTitle -match "Editor"}
in $selectedWindows there are all windows which title matches "Editor"
Now you can get the $selectedWindows in front and use sendKeys to work with the Window.
For getting the Window activated and in front i have a short example here:
http://pastecode.org/index.php/view/22992037
I'm writing an application where I have to send an email with an attachment using the default mail application.
Before the email is sent, I want the user to be able to edit the text, i.e. the application should just open the mail client with pre-filled recipient and attachment and give the user the opportunity to send it.
At very minimum I need the same effect I'd got if I selected "SendTo/Mail Recipient" from the context menu of the file.
Solutions based on the "mailto:" trick won't work as there are mail clients that do not support the "attachment=" part.
The most complete solution I've found is this one:
http://www.codeproject.com/Articles/3839/SendTo-mail-recipient
but it seems a lot of code for something so simple! (and also crashes when compiled with VS2008)
Is there any other option? It would be ok even if it was an external tool or script (e.g. a .vbs script to be launched with cscript).
I would advise you to use MAPI (Messaging Application Program Interface).
If dotNet can be part of the solution, here's a ready-to-use class in C# : Class for creating MAPI Mail Messages. It would give you something like this:
MapiMailMessage message = new MapiMailMessage("Test Message", "Test Body");
message.Recipients.Add("Test#Test.com");
message.Files.Add(#"C:\del.txt");
message.ShowDialog();
Otherwise, you can always do it in C++ if you feel confortable with it, like this answer suggest.
Then, you will be able to ShellExecute the binary executable and pass it some parameters.
Hope this helps :-)
I want to use the latest contents of a XAML file stored in TFS Source Control and embed it in a string variable, which is to be submitted as a query to MS SQL Server.
I have been using TFS Power Tools cmdlets in PowerShell (such as Get-TfsChildItem and Select-TfsItem) to successfully get handles on TFS files, changesets and shelvesets. But I cannot identify any methods or properties on these objects that would allow me to directly get the contents of a file into a variable.
I want to do something like this:
$tfsFileName = "$/MyBranch/MyFile.xaml"
$tfsServerName = "http://myTFSServer:8080/tfs"
$tfsServer = Get-TfsServer $tfsServerName
$xamlFile = Get-TfsChildItem -Item $tfsFileName -Server $tfsServer
$xamlContent = (Get-Content $xamlFile)
Is this possible, or do I always have to perform a Get Latest using tf.exe, and then get the contents of the local file?
I think you want the DownloadFile method on an Item. Eg:
$xamlFile = Get-TfsChildItem -Item $tfsFileName -Server $tfsServer
$xamlFile.DownloadFile("C:\Temp\file.xaml")
When I got the message about Team Foundation Services not being available on my server it turns out I had the wrong URI. I originally had http://tfs.mycompanyweb.mycompany.com:8080/tfs/ist/ISTDatabaseTools but changed it to http://tfs.mycompanyweb.mycompany.com:8080/tfs/ist and that error cleared up.
I still fail to get DownloadFile to work properly though. I'm trying to do something similar myself.
Joe
I am trying to send email using a Perl script from my Mac, for which I have installed
MIME::Lite module. I am using a basic script to test:
#!/usr/bin/perl
use MIME::Lite;
$msg = MIME::Lite->new(
From =>"abc\#gmail.com",
To =>"xyz\#gmail.com",
Subject =>"Demo",
Data =>"Sent :-):-)"
);
$msg->send();
I have already set up my email account in my macbook.
Please guide me if I need something else to check for as i am unable to send the email.
Gone are the days when you could just use a system call out to the command line:
mail boss#megacorp.net -s "I QUIT!" < body_of_message.txt
But if you install and configure mutt to talk to your mail server, you can do something pretty close:
mutt -s "I QUIT" boss#megacorp.net < body_of_message.txt
The hardest bit is configuring mutt, and that's not too bad. There are a ton of docs and howtos out there, like Mutt Configuration Doc ...or just google for "mutt configure" and the type of mail server that you're using; gmail, exchange, etc.
From there, in perl, you would just:
system("/path/to/mutt", "-s", "I QUIT", "boss\#megacorp.net", ...)
or die "Could not send Email";
I haven't used this module but I note the docs for it say
MIME::Lite is not recommended by its current maintainer. There are a
number of alternatives, like Email::MIME or MIME::Entity and
Email::Sender, which you should probably use instead. MIME::Lite
continues to accrue weird bug reports, and it is not receiving a large
amount of refactoring due to the availability of better alternatives.
Please consider using something else.
http://metacpan.org/pod/MIME::Lite
Having said that, you may need to do something like
Specify default send method:
MIME::Lite->send('smtp','some.host',Debug=>0);
MIME::Lite->send('smtp','some.host', AuthUser=>$user, AuthPass=>$pass);