Mail command does not work for Distribution List emails


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Mail command does not work for Distribution List emails
# 1  
Old 11-02-2016
Power Mail command does not work for Distribution List emails

mail works for my personal email address

Code:
mailx -s "Alert" mymail@mycomp.com<results.txt

mail fails for the Teams Distribution List (copied from outlook)

Code:
 
 mailx -s "Alert" #My-Team@mycomp.com<results.txt

This was the first problem.

The second problem is if I have the subject [-s] line as long as 180 characters the mail command does not work (no emails received.)

Please help with both my queries.
# 2  
Old 11-02-2016
If it is a windows file you need to run
Code:
dos2unix windows.txt mailing_list.txt  # example to clean it up first
echo "Message" | mailx -s "Subject" $(<mailing_list.txt)

I you use a file like your example you have add it to your personal .mailrc file or the /etc/aliases file first - need root for that. Then the alias filename cannot match any other alias files or any username
# 3  
Old 11-03-2016
The # is special in the shell and must be quoted. Put the mail address in quotes!
Code:
mailx -s "Alert" "#My-Team@mycomp.com" <results.txt

--
Maybe you can chop your overlong subject?
This User Gave Thanks to MadeInGermany For This Post:
# 4  
Old 11-03-2016
Tools

Quote:
Originally Posted by MadeInGermany
The # is special in the shell and must be quoted. Put the mail address in quotes!
Code:
mailx -s "Alert" "#My-Team@mycomp.com" <results.txt

--
Maybe you can chop your overlong subject?
How can I chop ? I could not understand the term "chop".

Is there a limitation on the length of the subject line ?
# 5  
Old 11-03-2016
Cut everything that is beyond MAX characters.
Example with expr
Code:
MAX=8
subject="a too long text"
subject=`expr x"$subject" : x"\(.\{1,${MAX}\}\)"`
echo "$subject"
a too lo

And use
Code:
mailx -s "$subject" "#My-Team@mycomp.com" <results.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issues sending emails using PostFix Mail Server

I'm unable to send email from my Linux server despite SMTP port 25 Active and Listening. # hostname TechX I checked the mail log ( /var/log/maillog ) and found the below error. I'm sharing all the ".cf" files seen in the error log. 1. # more /etc/postfix/main.cf # postfix... (0 Replies)
Discussion started by: mohtashims
0 Replies

2. Shell Programming and Scripting

[Fixed Itself!] Sending mail form script using sSMTP does not work

I have installed sSMTP and set it up to use my gmail. Sending from cli does work fine: msg file:From: test@gmail.com To test2@gmail.com Subject: test post This is a test Executing from console:ssmtp -t < msg does work fine. But from script it does not work:#!/bin/sh ssmtp -t < msg... (0 Replies)
Discussion started by: Jotne
0 Replies

3. Shell Programming and Scripting

Generate script perl mail log not work

Dear unix forum members, I'm working on a script that will parse a mail machine's logs and print a list of email addresses in this format: authen@domain.com | sender@domain | recipient@domain exam account1@domain1.com | sender2@domain2.com |... (3 Replies)
Discussion started by: puka
3 Replies

4. Shell Programming and Scripting

PHP Mail Script Takes Hours to Send emails

guys, i have a php script that i wrote that takes hours to send emails to recipients. i can't post the content of this script in here because the script contains some very important confidential information. so my question is, why is it that when the php script runs, it runs successfully, but... (3 Replies)
Discussion started by: SkySmart
3 Replies

5. UNIX for Dummies Questions & Answers

mail -s not showing subject on emails

Hi, I have a cron job that creates backups nightly and sends me an email with output from the script. I'm recieving the email and the output; however, the subject field is always empty. Here is what I have in my crontab 00 23 * * * sh /test_backup/test_script | mail -s "Backups"... (2 Replies)
Discussion started by: orahi001
2 Replies

6. UNIX for Dummies Questions & Answers

Command file for moving emails

hey guys. I'm trying to create a command file that moves my emails to a specified folder according to a keyword that is in the subject. like move emails with "hey" in the subject to a folder that exists in my mail folder named "hey". how do I go about that? thanx. (9 Replies)
Discussion started by: ~samantha89~
9 Replies

7. UNIX for Dummies Questions & Answers

Mail/Xmail doesn't work on Solaris 10

Hi again everyone. I have recently installed Solaris 10 on a server. Everything seems to work fine (users can be added and can log in, internet connectivity works, etc). However I'm struggling to get mail or mailx to work. Say there are two users on my server, Bob and Mary. Server hostname... (3 Replies)
Discussion started by: EugeneG
3 Replies

8. Shell Programming and Scripting

script doesn't work in another distribution

Hi everybody: I usually use Mandriva distro (in my laptop), and I have made some scripts. These scripts work correctly but now, in other computer which is installed Ubuntu don't work, and I have this error message: The script is: ..... echo "Your option is:" echo read option case... (1 Reply)
Discussion started by: tonet
1 Replies

9. Shell Programming and Scripting

mail program on shell script didn't work, please advise.

Hi, everyone: I post a new thread because previous post may sink and I hope the new one can be caught by your eyes. I created a shell script and the script works fine. However, the mail program part on script didn't send email to my email box and it also didn't provide any traceable... (7 Replies)
Discussion started by: duke0001
7 Replies

10. UNIX for Dummies Questions & Answers

Using mail to send HTML emails

Hi, I'm a programmer not a sys admin, so please excuse this if it seems a little out of place, but I think it applies to this forum. When I send my HTML newsletter from the server it comes in as plain text on some email programs and not others. Eudora is fine; Outlook Express, Hotmail, and... (2 Replies)
Discussion started by: dmennis
2 Replies
Login or Register to Ask a Question