Here's what I have:  cat UserReport.txt | mail -s "TestSubject" "nospam@gmail.com"   It's a small file, much smaller than a picture so it should send almost instantly. Though I receive nothing. I installed mailutils but might have installed it incorrectly.   How can I send an email from a bash script?
4893
How to send mail from the command line?
46098
I would like to setup an auto-responder in Gmail that includes an attachment. I can setup the auto-responder without issue but how do I add an attachment to an auto-responder in Gmail?
55138
mail -s "subject" xxxxx@gmail.com &lt;test.html works, but only for plain text email.  What is the correct way to send HTML email using the Linux command mail?
13205
Let's say I have a script that I want to pipe to another command or redirect to a file (piping to sh for the examples). Assume that I'm using bash.  I could do it using echo:  echo "touch somefile echo foo &gt; somefile" | sh   I could also do almost the same thing using cat:  cat &lt;&lt; EOF touch somefile echo foo &gt; somefile EOF   But if I replace "EOF" with "EOF | sh" it just thinks that it's a part of the heredoc.  How can I make it so that cat outputs text from stdin, and then pipes it to an arbitrary location?
120008
I am writing a Bash Script wherein I need to run some set of commands on a remote Linux server from my local computer using SSH. I want the results to be displayed on the terminal screen or dump the results in a file on my local system.   How can achieve this? Is the following syntax correct?  \#!/bin/bash . . . .  ssh &lt;user&gt;@&lt;remote_host&gt; 'COMMAND &gt;&gt; /path/to/file ; scp /path/to/file &lt;user&gt;@&lt;local_host&gt;:&lt;location&gt;; exit' . .   Thanks in advance.
73367
What I get:  host:~ user$ cat example.txt some texthost:~ stas$   What I want to get:  host:~ user$ cat example.txt some text host:~ stas$   Is there a way I can make cat behave like this?  I'm using bash on Mac OS X.
71966
I have a bash application that is producing some result, and I'd like to echo the result to either stdout or to a user chosen file. Because I also echo other interactive messages going to the screen, requiring the user to explicitly use the &gt; redirection when he wants to echo the result to a file is not an option (*), as those messages would also appear in the file.  Right now I have a solution, but it's ugly.  if [ -z $outfile ] then     echo "$outbuf"    # Write output buffer to the screen (stdout) else     echo "$outbuf" &gt; $outfile  # Write output buffer to file fi   I tried to have the variable $outfile to be equal to stdout, to &amp;1 and perhaps something else but it would just write to file having that name and not actually to stdout. Is there a more elegant solution?  (*) I could cheat and use stderr for that purpose, but I think it's also quite ugly, isn't it?
48012
I've created a script that runs every night on my Linux server that uses mysqldump to back up each of my MySQL databases to .sql files and packages them together as a compressed .tar file.  The next step I want to accomplish is to send that tar file through email to a remote email server for safekeeping.  I've been able to send the raw script in the body an email by piping the backup text file to mailx like so:  $ cat mysqldbbackup.sql | mailx backup@email.com   cat echoes the backup file's text which is piped into the mailx program with the recipient's email address passed as an argument.  While this accomplishes what I need, I think it could be one step better, Is there any way, using shell scripts or otherwise, to send the compressed .tar file to an outgoing email message as an attachment?  This would beat having to deal with very long email messages which contain header data and often have word-wrapping issues etc.
581
I have a txt file which has around 20000 email id. I want to know email count from gmail, yahoo, ymail, googlemail, aol, live,custom domain, gmx, and other temporary emails separately. And also i need to filter them and sort them in email domain order. How can i do that using notepad++? If any other program make this much easier than notepad ++  please refer that too.
41731
Forgive me if I'm missing something obvious here..... but why do most linux server distros come with both Dovecot AND Postfix (or sendmail)? As far as I'm aware all three of them are Mail Transfer Agents, with Dovecot having a 'secondary' function of being a Mail Delivery Agent...  Is Dovecot just not a very good MTA? Or is there some other reason why you'd want to use a combination of the above instead of a single program that seemingly does everything?
97554
I need to include below python script inside a bash script.   If the bash script end success, I need to execute the below script:  #!/usr/bin/python     from smtplib import SMTP import datetime debuglevel = 0  smtp = SMTP() smtp.set_debuglevel(debuglevel) smtp.connect('192.168.75.1', 25) smtp.login('my_mail', 'mail_passwd')  from_addr = "My Name &lt;my_mail@192.168.75.1&gt;" to_addr = "&lt;my_mail@192.168.75.1" subj = "Process completed" date = datetime.datetime.now().strftime( "%d/%m/%Y %H:%M" ) #print (date) message_text = "Hai..\n\nThe process completed."  msg = "From: %s\nTo: %s\nSubject: %s\nDate: %s\n\n%s" % ( from_addr, to_addr, subj, date, message_text )  smtp.sendmail(from_addr, to_addr, msg) smtp.quit()
45398
I want to implement a script on my server which will automatically send email alerts if the disk usage goes over 90% and second email alert when it goes over 95%. My filesystem is abc:/xyz/abc and the mount point is /pqr.  I have tried this:  ADMIN="someone@def.com"  ALERT=90  df -H | grep -vE 'abc:/xyz/pqr | tmpfs |cdrom' | awk '{ print $5 " " $1 }' | while read output; do    usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )    partition=$(echo $output | awk '{ print $2 }' )      if [ $usep -ge $ALERT ]; then        mail -s "Alert: Almost out of disk space $usep" $ADMIN      fi    done   But I am getting an error which says  line 7: [: Use: integer expression expected
104534
As a newbie Postfix user, I've gotten so far and now I am stuck with a SMALL problem.  I would like to configure my local network servers to send alerts and like using the following:   From address: hostname@example.com From name: Hostname   I can get #1 to work fine using smtp_generic_maps  The problem is that on my email client, the name is listed as "root" - as in the header shows the following:  Date: Sun, 29 Jul 2012 13:21:01 -0400 (EDT) From: zeus@example.com (root) To: undisclosed-recipients:;   I'd like to change it to From: zeus@example.com (Zeus)  I imagine that this can be done in the headers_check, but so far I haven't gotten anything to work and before I waste a ton of time trying to get this to work, I'd like to make sure I am on the right track.  My aliasing and generic_maps are set up correctly (As far as I can see and know - the results are correct!).  I just want to change that last bit in the From field to reflect the hostname.  I would also like to add something in the subject of the outgoing messages for easy filtering - something like Subject: [Zeus.domain] - "Original Subject".
122941
I have dedicated FreeBSD box, The email sending without  is working perfectly but very slow. The receiver receives email after almost 15 mins. I checked the maillog it says delays and timeouts that means the server keeps on trying to send email again and again until it successfully sends one. This is consuming lots of CPU.  I am seeking help for configuring smpt module to use my dedicated box's  smtp server, I need help in following places where I have ???? sign:  #SMTP server settings SMTP server -&gt; smpt.mydomain.com  # Tested by pinging, its working SMTP backup server -&gt; mail.mydomain.com  # Also verified by Ping SMTP port -&gt; 25 USE SSL  #SMTP Authentication Username -&gt; ??????? Password -&gt; ???????   I tried using localhost, also username and password of the dedicated box or leaving both lines blank which gives me:     Unable to send e-mail. Contact the site administrator if the problem   persists.   also checking the debug log doesn't show any log, it says check admin/reports/dblog but when I got to the link it just shows me the contents from admin/reports no any dblog
77510
If I set up a filter and send it a canned response, Gmail appends +canned.response to my username in the reply.  For example, given the filter "from:foo@example.com to:me@example.com" set up to send a canned response, when foo@example.com sends me an email the canned response comes from me+canned.response@example.com instead of me@example.com, exposing that I'm using a canned response.  Is there a way to avoid this?
105943
I have several servers running applications on debian. Each has the packages it requires for the application, and no more.  Currently, none have mail sending capability. However, I would like the output of tools like cron to be mailed to me.  The servers are hosted at an ISP site that provides a 'smart relay' server I should use for all outbound mail.  How should I configure my debian servers:   To permit local tools like cron to send mail, as something like automaton@example.com (I specifically do not want 'root@machinename') Not provide any inbound mail services Use the ISP's provided 'smart relay' for outbound mail   What package is good for such a 'minimal' mail service?
99729
Here's my test bash script. I'm not able to get it to work. I'm seeing two errors:   Use of uninitialized value $answer in chop at /usr/sbin/adduser line 589. Use of uninitialized value $answer in pattern match (m//) at /usr/sbin/adduser line 590.   Here's my script:  #!/bin/bash sudo adduser myuser &lt;&lt; ENDX password password First Last     Y ENDX exit 0   Here is the output:  me@mycomputer$ ./adduser.sh  Adding user `myuser' ... Adding new group `myuser' (1001) ... Adding new user `myuser' (1001) with group `myuser' ... Creating home directory `/home/myuser' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for myuser Enter the new value, or press ENTER for the default         Full Name []:   Room Number []:         Work Phone []:  Home Phone []:  Other []: Use of uninitialized value $answer in chop at /usr/sbin/adduser line 589. Use of uninitialized value $answer in pattern match (m//) at /usr/sbin/adduser line 590. Is the information correct? [Y/n] me@mycomputer$   This is on Kubuntu 12.04 LTS  $ bash --version bash --version GNU bash, version 4.2.25(1)-release (x86_64-pc-linux-gnu)   Here are the lines from adduser (system script - unmodified by me) with notations of the two relevant line numbers:  for (;;) {        my $chfn = &amp;which('chfn');     &amp;systemcall($chfn, $new_name);     # Translators: [y/N] has to be replaced by values defined in your     # locale.  You can see by running "locale yesexpr" which regular     # expression will be checked to find positive answer.     print (gtx("Is the information correct? [Y/n] "));     chop (my $answer=&lt;STDIN&gt;);        &lt;-- LINE 589     last if ($answer !~ m/$noexpr/o); &lt;-- LINE 590 }