Sendmail
I am trying to get a log file sent to my e-mail from my Linux RH server.
I run thing command cat smtest.txt | sendmail -t smtest.txt: to : *******@gmail.com cc : *****@foodconnex.com from : Your server name subject : Test mail TESTING 1 2 3 sendmail!! How can I send an attachment with this command or somehow cat the file into smtest.txt where the body is. I am open to other ideas, if there is a better sendmail command to run please let me know! Thanks ahead of time! TDUB |
Hi,
You can use mutt for the same: Code:
mutt -s "Subject" recipient@domain.com -a attachment.file < message-body.txt |
Above post is absolute way to send attachments from command line. But if you want to know another way, try uuencode command to send emails with attachments.
Take a look at this. http://www.cyberciti.biz/faq/howto-u...l-attachments/ If you want to know more about these two, take a look at http://www.shelldorado.com/articles/...tachments.html |
I can vote for uuencode, have used that the last couple of years :)
|
Quote:
I have a log called ai.log, so how would I attach that? Also what is in attachment.file and message-body.txt? mutt -s "AI Log" *******@gmail.com -a ???????????? |
Quote:
In message-body.txt you can put some text you want your recipient to read. If don't to, replace it with /dev/null Code:
mutt -s "AI Log" *******@gmail.com -a ai.log < /dev/null |
so found it searching for a simple solution...something like this could help you:
Code:
( echo "to: trail@somewhere.com" Code:
uuencode -m $ATTACH $(basename $ATTACH) |
Quote:
I run the command I found before cat smtest.txt | sendmail -t vi smtest.txt to : *******@gmail.com from : Your server name subject : Test mail I receive the e-mail, but when I run mutt -s "AI Log" ******@gmail.com -a ai.log < body.txt I do not receive any e-mail |
Quote:
|
Quote:
Code:
man mutt |
2 Attachment(s)
echo cat ai.log | mailx -s "Simple Test" *********@gmail.com
I check my E-mail and the Body is empty (simple sendmail 1) But in the Header it has the beginning of the file just as if I were to vi or cat the file out (simple sendmail 2) vi ai.log PROGRESS Version 9.1E as of Tue Oct 12 14:40:19 EDT 2004 After-image dates for this after-image file: #etc... so the cat command is working, it just isn't putting it in the body of the email but when I do this: echo "tester" | mailx -s "Simeple Test" ***********@gmail.com tester - shows up in the body!! Any body now how I can get whats inside ai.log to show up into the body using this command or get ai.log to be sent as an attachment? |
Hi,
You don't use echo and cat together. Just cat the logfile into the mailx command: Code:
cat ai.log | mailx -s "Simple Test" *********@gmail.com Code:
mailx -s "Simple Test" *********@gmail.com < ai.log |
Quote:
cat ai.log | mailx -s "Simple AI" ************@gmail.com #I do not get any e-mail Also when I do the redirect: mailx -s "Simple AI" **********@gmail.com < ai.log I do not get an email either, it does come back saying... you have new mail in /var/spool/mail/root . |
Quote:
If you don't get any mail, but mail has left your server, chances are that's it's finished into the spam folder |
1 Attachment(s)
I was able to tail ai.log to my email
(echo From: Blue_Star_1 [********@********]; echo Subject: Blue_Star_1 ; echo To: Foodconnex ; tail /appl/ai/ai.log) | sendmail `cat /appl/ai/recipients-list` But the problem now is it is coming in as an "unknown sender" which then it keeps dumping into my spam folder. I have the from but it doesn't seem to be looking at that. Does anyone have an idea with the command above so when my gmail gets the e-mail the from is from somewhere and not unknown sender? |
All times are GMT -5. The time now is 05:05 PM. |