Executing mail -s "testing" myemail#gmail.com just hangs. Why? - centos

I'm debugging a problem with a script not emailing out.
When i execute the following outside of the script:
mail -s "testing" myemail#gmail.com
It just hangs. The terminal doesn't give me any feedback what it's doing or if it has finished. I can only enter a another command by CTRL + Cing it. Any ideas why? Sometimes it does work if I let it hang long enough (I will get an email about 2 - 4 minutes later).
I'm running CENTOS 5 something. I've just uninstalled sendmail and installed postfix to see if this fixes it and the same thing appears to be happening.

If you enter the above and hit it should take you to a blank line and wait for you to type the actual text of the message. Once you've completed entering the message, you enter a .<enter> (dot or period followed by enter key) as the first character on a line and (depending on the version), it will usually ask you to enter any CC: addresses. Hit again to proceed past that and it should then send the mail.
The above command doesn't actually send anything, the -s sets the subject, but unless you include a file it will simply wait for you to type something. If, on the other hand, you want it to just send something quickly you can have it pull in a file as the content of the message, e.g. mail -s "testing" myemail#gmail.com < some_text_file. This will read some_text_file into the body of the email and send it immediately.

Related

Unix mail command queues but does not send

I have created a service that is supposed to send an automated email in HTML format by using UNIX mail command. It was working correctly until yesterday when suddenly stopped sending mails.
This is the command Im running programmatically
cat ./email.txt | mail -v -s "$(echo -e "Report for Last Week
Content-Type: text/html
Reply-to: abraham#corp.com
From: abraham#corp.com")" abraham#corp.com manolo#corp.com
The output looks like:
abraham#corp.com... queued
manolo#corp.com... queued
I am not getting any email, neither my partner...
I am not even able to run
echo "test"|mail -s "This is a test" abraham#corp.com
Im running on RedHat Linux.
Just in case someone needs help. The issue was related to the sendmail service of the OS.
I had to go service sendmail restart
It was as simple as that, however, I did compare the configuration files against a clean machine to make sure they were similar.

Ubuntu Command line email sending

I am trying to send an email to myself.
I have tried sudo apt-get install postfix mailutils followed by
mail -s "This is the subject" --append=FROM:myemail#gmail.com
Then i get:
To:
Cc:
...
I enter the info in the To and Cc spaces followed by pressing enter. But, then it just gives me empty space. I click enter and it just keeps giving me new lines. Then I click ctrl^C twice and it kills the email. I just want to send it.
Use Control-d to end it. Please see this Source https://linux.die.net/man/1/mail.
Make sure to add a relay host if you have one if the /etc/postfix/main.cf file

How do I use the MOSS script?

I am trying to run MOSS on my Mac OS X and I don't know what mistake I am making. I am not sure whether I am running the command properly or not. I downloaded this file as 'moss', gave this execution permissions and tried to run following:
./moss -l python -c "Assignment 1" -d assignment1/
I got the response as
Checking files . . .
OK
Which is wrong. The assignment1 directory has 4 python scripts. Two files are exactly similar, in one I have rearranged the code and in another I have changed the variable names.
I have sent the email for registration and I have not received any reply. So I am running the code with default user ID.
I also tried running it with sending each of those python files instead of working on a directory, still I get same response.
./moss -l python -c "Assignment 1" 1.py 2.py 3.py 4.py
Steps to get going with MOSS on your Mac:
Send an email at moss#moss.stanford.edu with the mail body containing the email you want to register.
Eg:
registeruser
mail "username#domain" <-- your email
You will then get a reply containing the script that you will need to save as “moss.pl”. Just make sure that your Mac has the “perl” folder within the “/usr/bin/“ folder. Else, change the path of the perl folder on the very first line of the script to be compatible to your machine.
Now set the execute permission using the command “chmod ug+x moss.pl”. This should allow you to send your queries to the Stanford server. If you were to not execute this command then you may be denied the permission to submit any queries.
Now submit the query to the server using the command similar to the following (note the command is not restricted to a single flag (i.e. -l)….refer the comments in the script for USAGE instructions):
“./moss.pl -l python file_1.py file_2.py”
The result on submitting a query such as above would be:
Checking files . . .
OK
Uploading file_1.py ...done.
Uploading file_2.py ...done.
Query submitted. Waiting for the server's response.
http://moss.stanford.edu/results/282371307.
Just review if you have followed all the steps above. I, then, don't see you having any issues getting the results. Maybe you were facing issues bcoz you were not registered initially.
Seems one should be registered to use it, instructions weren't clear on the site. I received the email finally with userid and ran the script, this time it worked.
I think you should resend the email in the format:
registeruser
mail youremail
In the reply email you will get your ID, replace it in the script and run the moss file again. You should get the link for the result.

Using "email" command in Cygwin [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am trying to use Cygwin to send an e-mail from the command line. This is what I am putting in:
email -f myaddress#blah.com -s "This is a test" -b toaddress#blah.com
I get this error message:
/bin/sh: /usr/lib/sendmail: No such file or directory
I created a folder in /usr/lib called "sendmail", and now I get this:
/bin/sh: /usr/lib/sendmail: is a directory
Can someone please give me a step-by-step on how to send an email from Cygwin? Like how to set it up and everything? I have looked everywhere and I am about ready to tear my hair out.
EDIT: Thanks for your responses guys. This is how I finally got it to work.
bash.exe -c "echo -e 'To: thepeopleimsendingitto#blah.com\nSubject: mySQL Upload\nSQL files from machines uploaded to log table successfully.' | sendmail -f me#blah.com otherpeople#blah.com"
Even though Cygwin was in my Windows path, it couldn't recognize it, so I had to run bash.exe directly and say "do this command as a Linux command". The echo is what is constructing the email itself. The \n characters separate it into "To", "Subject" and Body.
Apparently, email is a program that lets you submit an email message (a Mail Submission Agent) that relies on another program to actually send the message (a Mail Transfer Agent).
I enabled this on my Cygwin installation last week.
I am not using email but mutt, one of the alternatives Cygwin offers (see its package list).
I use mutt not only to submit the mail to be sent, but also to read it; it's a Mail User Agent (see some screenshots).
Like email, mutt relies on a Mail Transfer Agent to send mail, so I had to install one.
On Linux, popular choices are sendmail and postfix; but they do far more than you need and Cygwin doesn't offer them as packages. It does offer exim and ssmtp.
I installed the ssmtp package and ran the ssmtp-config utility. You have to make some decisions here. You must know which SMTP server you can use and whether you need any special configuration to communicate with it.
By the way, ssmtp does install an executable called sendmail, which is not the original sendmail, but behaves like it for the purposes you need it for.
Okay So i wasn't clear enough on my first attempt... I guess that is my fault, I will try to make this more clear.
In the mail-config it will ask for the sendmail binary. It should sound something like this :
Please enter the sendmail command line [/usr/sbin/sendmail -t -i]:
This is basically asking where is the sendmail binary installed and what parameters should i pass it to send a mail. Your sendmail binary is either not installed, or not installed in the location you are specifying.
To see if you have sendmail installed try
%sendmail;
If that works, to find the path of that binary try
%which sendmail;
If that does not work, either sendmail is not installed, or the location of sendmail needs to be appended to the env path variable. There no correct answer on how you want to set things up, but the minimum requirments to make this work is to have sendmail on the current machine, have it configured and pass the correct absolute path to the mail program in the mail-config.

Messages Using Command prompt in Windows 7

How to send message over network using command prompt in windows 7 ?
"net send" is a command using a background service called "messenger".
This service has been removed from Windows 7. ie You cannot use 'net send' on Vista nor Win7 / Win8.
Pity though , I loved using it.
There is alternatives, but that requires you to download and install software on each pc you want to use, this software runs as background services, and i would advise one to be very very very very careful of using these kind of software as they can potentially cause seriously damage one's system or impair the systems securities.
winsent innocenti /
winsent messenger
****This command is risky because of what is stated above***
Type "msg /?" in the command prompt to get various ways of sending meessages to a user.
Type "net send /?" in the command prompt to get another variation of sending messages across.
You can use the net send command to send a message over a network.
example:
net send * How Are You
you can use the above statement to send a message to all members of your domain.But if you want to send a message to a single user named Mike, you can use net send mike hello!
this will send hello! to the user named Mike.
Open Notepad and write this
#echo off
:A
Cls
echo MESSENGER
set /p n=User:
set /p m=Message:
net send %n% %m%
Pause
Goto A
and then save as "Messenger.bat" and close the Notepad
Step 1:
when you open that saved notepad file it will open as a file Messenger command prompt
with this details.
Messenger
User:
after "User" write the ip of the computer you want to contact and then press enter.