Pergunta

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.

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top