[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 685
  • Last Modified:

Mail is not working in cronjob

If i am using this command i am getting this error
mail -s 'Test Mail From' -a "test.zip" raghu@xpress.com

**********Getting this error*************
mail: invalid option -- a
Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...
            [-- sendmail-options ...]
       mail [-iInNv] -f [name]
       mail [-iInNv] [-u user]
0
gunasekharyalamuri
Asked:
gunasekharyalamuri
  • 4
  • 2
3 Solutions
 
woolmilkporcCommented:
Your mail client doesn't support the "-a" option.

Try "mutt" instead.

"man mutt" for more.
0
 
gunasekharyalamuriAuthor Commented:
[root@web02 ~]# man mutt
No manual entry for mutt
0
 
gunasekharyalamuriAuthor Commented:
insatall mutt package can i have any sample command to send mail using mutt
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
woolmilkporcCommented:
Which is your OS?

Get the mutt package for your OS and install it.

Alternatively you can use uuencode:

/usr/bin/uuencode /path/to/test.zip test.zip | /usr/bin/mail -s "Test" Raghu@xpress.com

Always use full paths in crontab!
0
 
woolmilkporcCommented:
/usr/bin/mutt -a /path/to/test.zip -s "Test" raghu@xpress.com
0
 
omarfaridCommented:
try this

uuencode test.zip < test.zip  | mail -s 'Test Mail From' raghu@xpress.com
0
 
woolmilkporcCommented:
The solution you accepted is essentially the same as I wrote in #38317654 earlier.

Anyway, thx for the points!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now