Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Can i send an attatchment with sendmail?

Posted on 1998-03-17
6
Medium Priority
?
229 Views
Last Modified: 2013-12-23
Hello Expert,

Can i send an attatchment with sendmail?
Thanks

cwc
0
Comment
Question by:cwc061097
[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
6 Comments
 
LVL 1

Expert Comment

by:zonker031798
ID: 1583194
It would help if you could specify (a) what OS you're
using (b) what version of sendmail you're running  and
(c) whether the solution to your problem can involve a MUA
or not.
0
 
LVL 3

Expert Comment

by:elfie
ID: 1583195
Isn't sendmail the "lowlevel"  program that takes care of the actual sending/re-routing of the mails? I thjough it depends which end-user mailsystem you are using (eg. elm, openmail, mail, ...)

0
 
LVL 1

Accepted Solution

by:
dirge earned 400 total points
ID: 1583196
I assume you want a command line solution. You will need at least uuencode, which comes with most Unix distributions, anyway.

The simplest, with no message, would be

uuencode filename filename | sendmail user@domain.com

With a message, it's a bit different. First create a file "msgfile" with the message you want to send, making sure you put at least one blank line after the message, then

uuncode filename filename >> msgfile
sendmail user@domain.com <<msgfile

You may of course, write this into a script or use some other more efficient method, but the basic idea should remain the same.

Here's a sample quick-and-dirty script ("sendattach"):

-------------------------------
#!/bin/bash

msg=`cat`
to=$1
subject=$2
attach=$3
file=`uuencode $attach $attach`
sendmail $to <<END
From: your@address.com
Subject: $subject
To: $to

$msg

$file
END

-------------------------------

Replace your@address.com with your address, of course, or remove the entire From: line to use your default address. Don't forget to chmod +x sendattach. Launch using something like

sendattach recipient@domain.com "This is a test" someimage.gif

Type in message, and press Control-D.

Hope this helps!
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.

 

Author Comment

by:cwc061097
ID: 1583197
Thanks Dirge for your help
Can u also make a sample script that i can use with perl 5
Thanks again

CWC
0
 
LVL 1

Expert Comment

by:dirge
ID: 1583198
Hi. Thanks for the points!

You'd probably be better off using the MIME-tools Perl modules. The "mimesend" example should be a great starting point. You could even use it as-is in many cases.

You can get MIME-tools from CPAN:

http://www.perl.com/CPAN-local/modules/by-module/MIME/MIME-tools-4.116.tar.gz

Leave a message here or email me at dirge@iquill.net if you need more help.

-dirge
0
 

Author Comment

by:cwc061097
ID: 1583199
Hi Dirge
Thanks for the tip

CWC
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.

Question has a verified solution.

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

If you’re involved with your company’s wide area network (WAN), you’ve probably heard about SD-WANs. They’re the “boy wonder” of networking, ostensibly allowing companies to replace expensive MPLS lines with low-cost Internet access. But, are they …
This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

660 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