Solved

Can i send an attatchment with sendmail?

Posted on 1998-03-17
6
219 Views
Last Modified: 2013-12-23
Hello Expert,

Can i send an attatchment with sendmail?
Thanks

cwc
0
Comment
Question by:cwc061097
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 100 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
New! My Passport Wireless Pro Wi-Fi Mobile Storage

Portable wireless storage to offload, edit, and stream anywhere.

High-capacity, wireless mobile storage designed to accompany professional photographers and videographers in the field to easily offload, edit and stream captured photos and high-definition videos.

 

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

When it comes to security, there are always trade-offs between security and convenience/ease of administration. This article examines some of the main pros and cons of using key authentication vs password authentication for hosting an SFTP server.
Most of the applications these days are on Cloud. Cloud is ubiquitous with many service providers in the market. Since it has many benefits such as cost reduction, software updates, remote access, disaster recovery and much more.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now