Thanks George. I don't have a problem with Mailform, I guess I lack a
bit of understanding here. I'm very new to CGI::App. I did have some
trouble getting Mailform to work, but I think I was messing up the
smtp stuff (my bad, not Mailform's).
Anyway, I was generally looking for something more eloquent than this:
#------------------------------------------------------------------------------
# Create a new volunteer record in the database
# and subscribe her/him to the email list
#------------------------------------------------------------------------------
sub _create_volunteer {
my $self = shift;
my $q = $self->query;
my $sql = "INSERT INTO volunteer (
first,
last,
email,
phone)
values (?, ?, ?, ?)";
$self->dbh->{PrintError} = 0;
$self->dbh->{RaiseError} = 1;
my @params =(
$q->param('first'),
$q->param('last'),
$q->param('email'),
$q->param('phone')
);
$self->dbh->do($sql, undef, @params, $q->param('id'));
my $self = shift;
# Add new volunteer to volunteers mailman list
my $sendmail = '/usr/sbin/sendmail';
# Grab the email address from the form
my $mail = ( $q->param("email") );
# Send it
open MAIL, "|$sendmail -oi -t" or die "Can't open pipe to $sendmail:
$!\n";
print MAIL <<"EOF";
To: [EMAIL PROTECTED]
From: $mail
Subject:
EOF
close MAIL or die "Can't close pipe to $sendmail: $!\n";
}
It works, but I assume there must be a better way. Maybe a plugin like
the DBH plugin where you could have an external config file with all
the sendmail settings, then you set teh params and then you execute it
in one line. Is there such a plugin?
On 9/6/07, George Hartzell <[EMAIL PROTECTED]> wrote:
> Jay Varner writes:
> > Hello, I'm not sure why I can't wrap my head around this and get it to
> > work but I'm trying to have a runmode use sendmail to email results
> > from a form.
> >
> > Basically, say someone signs up for something via a web form. I want
> > the info entered to both go to the database and send out a
> > confirmation email. Seems like a very basic function but I have had no
> > luck searching for sending email via a runmode (or at least a function
> > kicked off by a runmode), and none of my half backed tries didn't work
> > out at all.
> >
> > I did look at CGI::Application::Mailform but I'm looking for something
> > that is integrated with the rest of my app.
> >
> > Thoughts?
>
> What is it that you don't like about CGI::Application::Mailform.
>
> Have you looked at MIME::Lite or Net::SMTP, which make it pretty darn
> easy to send a message? If they're not what you need, tell us why and
> maybe someone can make a better suggestion.
>
> I've used MIME::Lite happily in the past. No matter what package you
> use you'll want to do a good job vetting the information that's
> submitted before you use it to send mail, lest you end up an unwitting
> spam relay.
>
> g.
>
>
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]