Solved

script isn't sending email to me

Posted on 2002-04-27
5
192 Views
Last Modified: 2010-03-05
#!/usr/bin/perl -w
print "Content-type: text/html\n\n";


use CGI qw(:standard);

open(MAIL, "|/usr/sbin/sendmail -oi -t") or die "can't do sendmail: $!";
print MAIL <<eof;
From: mysite.com
To: me@ix.netcom.com
Subject: Someone submitted information via your form

[form info here]

eof
save_parameters(*MAIL);
close(MAIL) or die "can't close sendmail: $!";

print <<VERIFY;

Email sent.

VERIFY

*********************

I'm seeing "Email sent" in the browser, but I'm receiving no email.  No error messages.  I think I should see

From: mysite.com
To: me@ix.netcom.com
Subject: Someone submitted information via your form

[form info here]

0
Comment
Question by:miredo
[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
5 Comments
 
LVL 12

Expert Comment

by:lexxwern
ID: 6973284
Does your server have Sendmail??
0
 

Author Comment

by:miredo
ID: 6974439
Yes, on my account page, my host posts the path to sendmail:
/usr/sbin/sendmail
0
 
LVL 1

Expert Comment

by:andy_wolf
ID: 6990670
Maybe the "-oi" should be "-i" in your sendmail call...

Other than this you can also use the MIME::Tools module like this:

---
use MIME::Entity;

my $address_string = 'me@ix.netcom.com';
my $recipient_address = 'you@is.netcom.com';
  # mysite.com is no valid email address !

my $data_string = <<eof;

[form info here]

eof

my $mail = MIME::Entity->build(
  'Encoding'     => 'quoted-printable',
  'From'         => $address_string,
  'To'           => [ $recipient_address ],
  'Subject'      => "Whatever your subject is",
  'Data'         => $data_string
);

open MAIL, "| /usr/sbin/sendmail -t -i" or die "open: $!";
$top->head->fold;
$top->print(\*MAIL);
close MAIL;

Hope that helps...Andy

0
 
LVL 1

Accepted Solution

by:
andy_wolf earned 55 total points
ID: 6990672
Well the module must be installed therefor which is really easy if you have root access to the system:

> perl -MCPAN -e 'install MIME::Tools'

If you have no root access ask your system administrator to install this module for you if it is not already available. This module is very useful because it handles a lot of work in the background to provide a mail in correct/RFC-conforming format...

Andy
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7116821
Have you been helped here or is more needed?
Moondancer - EE Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Six Sigma Control Plans

624 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