Solved

Embarrassing Email Question

Posted on 2007-03-22
4
187 Views
Last Modified: 2010-05-18
This is embarrassing, but that's never stopped me before.
I've been using the same chunk of code to send simple acknowledgement emails from a script for a long time (it works).
I know it's not MIME:, but I don't know if its SENDMAIL, or what.
I wanted to add an attachment to this, but it's looking as if this isn't the format inwhich to do it.
So the question is - what kind of MAIL is used below, and will it allow attachments
#####################################################
 if (open(MAIL,"|mail tmccar10\@ford.com")){                
          print "Emailed to Decision Support!\n<BR>";
          print MAIL "\n";
          print MAIL "Name: $Q::name (PROFS ID: $Q::profsid) has submitted the following request for a NEW report on $date\n";
          print MAIL "Department: $Q::deptno\n";
...
}
else {
      print "Open to mail failed!\n<BR>";      
}
            close(MAIL);
0
Comment
Question by:tmccar10
  • 2
  • 2
4 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 50 total points
ID: 18775019
The 'mail' command is a simple command line based tool to send/read mail.  It does not have native support for attachments.  As for the Mail Transport Agent (MTA) it uses, it could be sendmail, postfix or whatever.  It doesn't care.

If you want to send attachments, the most popular method in Perl by a huge margin is to use the MIME::Lite module.  It's very simple to install and use.

See http://search.cpan.org/~yves/MIME-Lite-3.01/lib/MIME/Lite.pm
0
 

Author Comment

by:tmccar10
ID: 18775111
Thanks TIn TIn-

I'm aware of MIME, I don't think I understand it very well.
One question, if I can prevail on you.
I want to use this to give information to a another user that was collected on a form.
Like $Q::Name;
       $Q::Address;
I don't see where I list those. Is it "data=>?
0
 
LVL 48

Expert Comment

by:Tintin
ID: 18775300
Yes, it goes in the data section ,eg:

my $text = <<EOF;
Emailed to Decision Support!<BR>

Name: $Q::name (PROFS ID: $Q::profsid) has submitted the following request for a NEW report on date
Department: $Q::deptno
EOF

my $msg = MIME::Lite->new(
                 From     =>'user@ford.com',
                 To       =>'tmccar10@ford.com',
                 Subject  =>'Your subject',
                 Data     => $text
                 );

$msg->send or die "Can not send mail $!\n";
0
 

Author Comment

by:tmccar10
ID: 18775343
Thanks, Tin Tin, as always.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

706 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

19 Experts available now in Live!

Get 1:1 Help Now