Solved

Can i send an attatchment with sendmail?

Posted on 1998-03-17
6
220 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
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.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
display iPhone Wifi network name 19 102
DNS and NSLOOKUP 21 74
Map local drive to folder for all rdp users 7 40
Filter IP range with PowerShell 1 40
Don’t let your business fall victim to the coming apocalypse – use our Survival Guide for the Fax Apocalypse to identify the risks and signs of zombie fax activities at your business.
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.
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…
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…

776 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