Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with sending mail

Status
Not open for further replies.

bigscouse

MIS
Oct 6, 1998
420
GB
I am trying to set up a script for mailing from a unix server running unixware 2.1.3. I wish to send reports and tab sperated data files to NT users utilising MS Exchange. <br>
I would appreciate any assistance.<br>
<br>
Thanks, Ged.<br>
<p>Ged Jones<br><a href=mailto:gedejones@hotmail.com>gedejones@hotmail.com</a><br><a href= > </a><br>
 
If you just want to send the file 'as is' as the body text of the message, this will work:<br>
<br>
cat /my/report/file ¦ mailx -s&quot;My Subject Line&quot; <A HREF="mailto:recipient@my.nt.mail.doma">recipient@my.nt.mail.doma</A>in<br>
<br>
If you wanted a standard header and footer with the report in the centre, set these up as files somewhere and with a slight amendment:<br>
<br>
cat /my/header/file /my/report/file /my/footer/file ¦ mailx -s&quot;My Subject Line&quot; <A HREF="mailto:recipient@my.nt.mail.doma">recipient@my.nt.mail.doma</A>in<br>
<br>
Hope this helps. Let us know if you want something a little more complex.<br>
<br>
If you're actually asking about setting up sendmail, for instance, to send mail to your NT domain, that would need a bit more thinking about, and you might want to post to one of the mail forums.<br>
<br>
Hope this helps.
 
Thanks AndyBo, that works ok. However I need to send reports and files for excel. I reckon I need to use sendmail. <p>Ged Jones<br><a href=mailto:gedejones@hotmail.com>gedejones@hotmail.com</a><br><a href= > </a><br>
 
Hi,<br>
<br>
Actually - using mailx *will* use sendmail to deliver the actual mail. Unless sendmail is set up correctly AndyBo's suggestion will not work - it does so you don't need to worry about it.<br>
<br>
Sendmail is quite low level (as in - difficult to use) so stay away from it if you can. It is usually called by other programs (like mailx) and is best left that way.<br>
<br>
Andy's suggestion will mail any text file you can generate. If you create a tab delimited file for excel you should be able to use it after sending it that way. Is it that you are having trouble generating the file?<br>
<br>
Regards<br>
<br>
Mike<br>
<p>Mike Lacey<br><a href=mailto:Mike_Lacey@Cargill.Com>Mike_Lacey@Cargill.Com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Just had a thought - as file will be sent as the mail message body, and not as an attachment, it might make it a little difficult for the users to read the file into Excel. If you wanted to send the file as an attachment, then things would get a bit trickier. Got to admit, it's not something I've ever tried to do from the command file.<br>
<br>
As it stands, the user's would have to copy and paste the message body into a text file, then load the text file into Excel. Although, maybe they could export or save the message from their mail client as a text file, and load this into Excel. I've done similar things before, telling the Excel import wizard to ignore the first x lines of the file. (ie, in your case the mail headers.)<br>
<br>
Bells are ringing about a mail module for perl, though, and this might be able to send files as attachments to mail messages... Not had chance to check it out, but if you have a dig around on CPAN you should be able to find something.<br>
<br>
Also, I've got to agree with Mike re: sendmail config. Unless you're confident about configuring sendmail already, and if your current setup is working OK, it's best left alone :)
 
Good point - if you're a perl person there's an excellent module that lets you do attachments quite nicely - CPAN - as the man said.<br>
<br>
Mike<br>
<p>Mike Lacey<br><a href=mailto:Mike_Lacey@Cargill.Com>Mike_Lacey@Cargill.Com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Thanks guys, I had noticed that ther data was sent in the body of the mail text and advised the user to copy and paste it out then save it as txt and then load it into excel. This will suffice for now but weare looking for tools that will eable distribution of reports and excel data. I believe there is a product available that allows reports to be spooled using the lp command to virtual printers that cotain email addresses and will then forward the report to the mailbox as an attachment. If I find it I will let you know the results. <p>Ged Jones<br><a href=mailto:gedejones@hotmail.com>gedejones@hotmail.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top