Solved

Embarrassing Email Question

Posted on 2007-03-22
4
194 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
[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
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying 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

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…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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…

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