Solved

Embarrassing Email Question

Posted on 2007-03-22
4
193 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…

808 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