Solved

Perl & Sendmail

Posted on 2000-04-09
5
227 Views
Last Modified: 2013-12-25
Hi ! I've created a temp-text file which I want to send to somebody. How do I do tis with sendmail ? Is there a command like sendmail to xy@xy.com from xy@xy.com content tempfile.tmp

regards
ItsMe
0
Comment
Question by:ItsMe
[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
  • 3
5 Comments
 
LVL 1

Accepted Solution

by:
lambda earned 30 total points
ID: 2699073
I think it's not possible to send the file as attachment using sendmail.
But you can send it like this:


open (MAIL_MSG, "path/to/MailMsg.txt");
while (<MAIL_MSG>)
{
      $body .= $_;
}
close (MAIL_MSG);

open(MAIL, "|/usr/sbin/sendmail -t ") || return 1;
 select (MAIL);

 print  MAIL "To\: $To_email\n";
 print  MAIL "From\: Name <abc\@def.com>\n";
 print  MAIL "Subject\: text attached\n";

 print  MAIL "\n$body\n";

 close(MAIL);
0
 
LVL 1

Expert Comment

by:lambda
ID: 2699080
U can remove the line
select (MAIL);

from the code, it is not actually required


£.
0
 

Author Comment

by:ItsMe
ID: 2699921
Hi !
what does the | means ?

regards
ItsMe
0
 
LVL 84

Expert Comment

by:ozo
ID: 2701052
perldoc -f open
0
 
LVL 1

Expert Comment

by:lambda
ID: 2702788
The '|' sends the output to the sendmail program.
For more details, you can type what ozo suggested, at the prompt.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert .csv to tab delimited text 11 50
Powershell GUI 11 58
using VBS script to log into internal website 6 10
PowerShell and cisco ios 3 41
This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

735 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