Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Perl & Sendmail

Posted on 2000-04-09
5
Medium Priority
?
243 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 120 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

704 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