Solved

Perl & Sendmail

Posted on 2000-04-09
5
215 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
  • 3
5 Comments
 
LVL 1

Accepted Solution

by:
lambda earned 30 total points
Comment Utility
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
Comment Utility
U can remove the line
select (MAIL);

from the code, it is not actually required


£.
0
 

Author Comment

by:ItsMe
Comment Utility
Hi !
what does the | means ?

regards
ItsMe
0
 
LVL 84

Expert Comment

by:ozo
Comment Utility
perldoc -f open
0
 
LVL 1

Expert Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

763 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

8 Experts available now in Live!

Get 1:1 Help Now