Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to create a script in Ubuntu 14.04 to send an email with attachment?

Posted on 2015-02-02
8
Medium Priority
?
255 Views
Last Modified: 2015-06-29
I would like to create a script in Ubuntu14.04 to send an email, in an Exchange 2010 environment.   I want to double click on the file and then activate the script to send an email and attach a file it find on the desktop.
0
Comment
Question by:100questions
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 5

Expert Comment

by:R. Toby Richards
ID: 40584726
echo "This is the message body" | mutt -s "subject of message"  -a "/path/to/file.to.attach" -- recipient@domain.com

Open in new window


You may have to install mutt. On Ubuntu, "sudo apt-get install mutt" worked fine for me. You may or may not need an SMTP server installed. My box has Sendmail, so I wasn't able to test it without having Sendmail.
0
 
LVL 12

Accepted Solution

by:
Tej Pratap Shukla ~Dexter earned 2000 total points
ID: 40585473
Try mutt - a terminal-based e-mail client for Unix-like systems.

To install mutt: -

# apt-get install mutt

Syntax of sending Email using mutt is given below: -

echo "Message Body"mutt  -s "Subject of Mail" -a <path of  attachment file> -c <email address of CC>  mail address of recipient

here s defines the subject of the mail and abc@xyz.com represents the recipients address

for further reference visit: http://www.tecmint.com/send-mail-from-command-line-using-mutt-command/

Thanks
Dexter
0
 

Author Comment

by:100questions
ID: 40594138
Thanks. Will Mutt work with Exchange 2010?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 5

Expert Comment

by:R. Toby Richards
ID: 40594166
Yes, as long as the SMTP port (tcp/25) on the Exhange server is available to the Linux computer.
0
 

Author Comment

by:100questions
ID: 40615077
On what version of Ubuntu will this work on?
0
 
LVL 5

Expert Comment

by:R. Toby Richards
ID: 40615081
Any version. Mutt is older than Ubuntu. It is older than Linux for that matter.
0
 

Author Comment

by:100questions
ID: 40857259
I have not tried this, no need for this at this time.
0
 

Author Closing Comment

by:100questions
ID: 40857260
Thanks.  Unsure if this works, as currently I am not in need of this any longer.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question