Solved

script isn't sending email to me

Posted on 2002-04-27
5
187 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

Technology Partners: 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

Suggested Solutions

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…

759 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