cgi mail script anyone?

Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default cgi mail script anyone?

    I need to send a mail from the cgi. It must be able to have a reply or
    sender as someone different from the local web owner (apache). My
    configuration:
    redhat 9/qmail/vpopmail

    The example below will be typically what I want:

    To: [email]jdoe@some.com[/email]
    From: [email]support@some.com[/email]
    Subject: "hello support test"
    this is a test
    with all your support

    I see alot of parts but can't get it working.
    can someone put a little script together that does this?

    thanks,
    -rkl
    perl@swanmail.com Guest

  2. Similar Questions and Discussions

    1. Form Mail Script
      Hello, could anyone tell me exactly how to edit the script to make it work and where to place the files on my website directories? I've been...
    2. Help with Mail Script CDO/ASP and Session Var
      I have a mailscript CDO using ASP technology, and I need to include the aid valude or id value of the recordset in the script so they can click the...
    3. Mail Script Help.
      "." </@.> writes: Yo Walt, try putting your name in the From field of your post, makes you look less lurky. Try, using the Open URL script...
    4. SEND MAIL script with check box
      okay - i've figured out how to make a check box into a button that performs a SEND MAIL script. but - i can't figure out how to add a step to the...
    5. the script hangs up when i try to send mail with attachments using MAIL::Sender...???
      As said in the topic... when i try to send an e-mail message using Mail::Sender the script hangs up before execution of $sender ->...
  3. #2

    Default Re: cgi mail script anyone?

    [email]perl@swanmail.com[/email] wrote:
    > I need to send a mail from the cgi. It must be able to have a reply or
    > sender as someone different from the local web owner (apache).
    See [url]http://search.cpan.org/modlist/Mail_and_Usenet_News/Mail[/url]

    --
    ZSDC

    Zsdc Guest

  4. #3

    Default RE: cgi mail script anyone?

    Perhaps you can use sqwebmail. It supports vpopmail authentication but
    requires Maildir format mailboxes. Maildirs were introduced with qmail
    and have reliability advantages over the usual Mailbox files. If you
    need to convert Mailboxes to Maildirs, see the qmail docs. Sqwebmail is
    available from inter7, the developers of vpopmail, see
    [url]http://www.inter7.com/sqwebmail.html[/url].

    If you just need to send mail, I've found Mail::Send and Mail::Mailer
    work well for that from the command line. You would just need to build
    a CGI forms interface to them for sending mail through a web interface.
    Basically that would require capturing the mail header and body in perl
    variables and passing them to a function or separate program that send
    the message using the Mail::Send|Mail::Mailer routines. Each of those
    packages includes several example programs.

    -tristram

    Tn Guest

  5. #4

    Default RE: cgi mail script anyone?

    I'm just trying to send mail from a programming script NOT a real client.
    For example, a monitor script calculating the disk storage and sending a
    report/alert via the perl program.

    I really don't want to add more library or module than necessary. So if
    you guys can detect something wrong with this code let me know?

    #!/usr/bin/perl

    use strict;
    use warnings;

    my $mailprog = '/bin/mail';
    my $tomail = 'bob@some.com';
    my $inquirer = 'support@some.com';

    #EMAIL
    open (MAIL, "|$mailprog") || die "Can't open mailprog.\n";
    print MAIL "To: $tomail\n";
    print MAIL "Reply-To: $inquirer\n";
    print MAIL "From: $inquirer\n";
    print MAIL "Subject: Inquiry Response Request\n\n";
    print MAIL <<"PrintTag";
    Please respond to the following inquiry:
    blah blah blah, message here
    PrintTag
    close(MAIL);


    -rkl
    > Perhaps you can use sqwebmail. It supports vpopmail authentication but
    > requires Maildir format mailboxes. Maildirs were introduced with qmail
    > and have reliability advantages over the usual Mailbox files. If you
    > need to convert Mailboxes to Maildirs, see the qmail docs. Sqwebmail is
    > available from inter7, the developers of vpopmail, see
    > [url]http://www.inter7.com/sqwebmail.html[/url].
    >
    > If you just need to send mail, I've found Mail::Send and Mail::Mailer
    > work well for that from the command line. You would just need to build
    > a CGI forms interface to them for sending mail through a web interface.
    > Basically that would require capturing the mail header and body in perl
    > variables and passing them to a function or separate program that send
    > the message using the Mail::Send|Mail::Mailer routines. Each of those
    > packages includes several example programs.
    >
    > -tristram
    >
    >
    perl@swanmail.com Guest

  6. #5

    Default Re: cgi mail script anyone?

    I can't seem to get this script working. I just want a simple code so I
    can send mail that can change the reply address. I could get the command
    line /bin/mail working with a system("/bin/mail..."); but I could not
    change the From so it doesn't say [email]root@some.com[/email]. I don't want to open
    socket and send smtp or load some modules.

    Any ideas?

    my $mailprog = '/bin/mail';
    my $tomail = 'bob@some.com';
    my $frmail= 'support@some.com';
    #EMAIL
    open (MAIL, "|$mailprog") || die "Can't open mailprog.\n";
    print MAIL "To: $tomail\n";
    print MAIL "Reply-To: $frmail\n";
    print MAIL "From: $frmail\n";
    print MAIL "Subject: Inquiry Response Request\n\n";
    print MAIL <<"PrintTag";
    Please respond to the following inquiry:
    blah blah blah, message here
    PrintTag
    close(MAIL);

    thanks,
    rkl
    > At 07:14 PM 10/3/2003, you wrote:
    >>I need to send a mail from the cgi. It must be able to have a reply or
    >>sender as someone different from the local web owner (apache). My
    >>configuration:
    >> redhat 9/qmail/vpopmail
    >>
    >> The example below will be typically what I want:
    >>
    >>To: [email]jdoe@some.com[/email]
    >>From: [email]support@some.com[/email]
    >>Subject: "hello support test"
    >>this is a test
    >>with all your support
    >>
    >>I see alot of parts but can't get it working.
    >>can someone put a little script together that does this?
    >>
    >>thanks,
    >>-rkl
    >>
    >>--
    >>To unsubscribe, e-mail: [email]beginners-cgi-unsubscribe@perl.org[/email]
    >>For additional commands, e-mail: [email]beginners-cgi-help@perl.org[/email]
    >
    >
    >
    perl@swanmail.com Guest

  7. #6

    Default RE: cgi mail script anyone?

    /bin/mail and other Unix/Linux user mail agents preserve the From
    address based on your login UID. There is no way to make them lie about
    the From address without modifying their sources. It's possible to
    setup domain masquerading with sendmail or qmail. That way you could
    fake the @some.com part. But sendmail, qmail and vpopmail rely on the
    underlying login UID to make the username part of the mail address. If
    you're root, then you can create a login account with the name of your
    liking and su to that account before sending mail.

    However, I encourage you to dig into the installation and use of
    contributed, opensource perl modules, since you have before you a
    simplest opportunity for doing it that will payoff quick.

    -tristram


    -----Original Message-----
    From: [email]perl@swanmail.com[/email] [mailto:perl@swanmail.com]
    Sent: Friday, October 03, 2003 11:25 PM
    To: Teresa Raymond; [email]beginners@perl.org[/email]
    Subject: Re: cgi mail script anyone?


    I can't seem to get this script working. I just want a simple code so I
    can send mail that can change the reply address. I could get the command
    line /bin/mail working with a system("/bin/mail..."); but I could not
    change the From so it doesn't say [email]root@some.com[/email]. I don't want to open
    socket and send smtp or load some modules.

    Any ideas?

    my $mailprog = '/bin/mail';
    my $tomail = 'bob@some.com';
    my $frmail= 'support@some.com';
    #EMAIL
    open (MAIL, "|$mailprog") || die "Can't open mailprog.\n"; print MAIL
    "To: $tomail\n"; print MAIL "Reply-To: $frmail\n"; print MAIL "From:
    $frmail\n"; print MAIL "Subject: Inquiry Response Request\n\n"; print
    MAIL <<"PrintTag"; Please respond to the following inquiry: blah blah
    blah, message here PrintTag close(MAIL);

    thanks,
    rkl
    > At 07:14 PM 10/3/2003, you wrote:
    >>I need to send a mail from the cgi. It must be able to have a reply or
    >>sender as someone different from the local web owner (apache). My
    >>configuration:
    >> redhat 9/qmail/vpopmail
    >>
    >> The example below will be typically what I want:
    >>
    >>To: [email]jdoe@some.com[/email]
    >>From: [email]support@some.com[/email]
    >>Subject: "hello support test"
    >>this is a test
    >>with all your support
    >>
    >>I see alot of parts but can't get it working.
    >>can someone put a little script together that does this?
    >>
    >>thanks,
    >>-rkl
    >>
    >>--
    >>To unsubscribe, e-mail: [email]beginners-cgi-unsubscribe@perl.org[/email]
    >>For additional commands, e-mail: [email]beginners-cgi-help@perl.org[/email]
    >
    >
    >

    --
    To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    For additional commands, e-mail: [email]beginners-help@perl.org[/email]

    Tn Guest

  8. #7

    Default Re: cgi mail script anyone?

    Thanks, you did good with this code for me. I did not want to load more
    library as most suggested. This works just fine with only one exception. I
    needed to use the -t option. Here is the revised version which worked for
    me:

    #/usr/bin/perl
    use strict;
    use warnings;

    my $mailprog = '/usr/sbin/sendmail -t'
    my $empemail='bob@some.com';
    my $inquirer='support@some.com';

    #EMAIL
    open (MAIL, "|$mailprog") || die "Can't open mailprog.\n";
    print MAIL "To: $empemail\n";
    print MAIL "Reply-To: $inquirer\n";
    print MAIL "From: $inquirer\n";
    print MAIL "Subject: Inquiry Response Request\n\n";
    print MAIL <<"PrintTag";
    Please respond to the following inquiry:
    blah blah blah, message here
    PrintTag
    close(MAIL);

    --end code--
    > $mailprog = '/your/sendmail/path'
    >
    > #EMAIL
    > open (MAIL, "|$mailprog") || die "Can't open mailprog.\n";
    > print MAIL "To: $empemail\n";
    > print MAIL "Reply-To: $inquirer\n";
    > print MAIL "From: $inquirer\n";
    > print MAIL "Subject: Inquiry Response Request\n\n";
    > print MAIL <<"PrintTag";
    > Please respond to the following inquiry:
    > blah blah blah, message here
    > PrintTag
    > close(MAIL);
    >
    >
    > At 07:14 PM 10/3/2003, you wrote:
    >>I need to send a mail from the cgi. It must be able to have a reply or
    >>sender as someone different from the local web owner (apache). My
    >>configuration:
    >> redhat 9/qmail/vpopmail
    >>
    >> The example below will be typically what I want:
    >>
    >>To: [email]jdoe@some.com[/email]
    >>From: [email]support@some.com[/email]
    >>Subject: "hello support test"
    >>this is a test
    >>with all your support
    >>
    >>I see alot of parts but can't get it working.
    >>can someone put a little script together that does this?
    >>
    >>thanks,
    >>-rkl
    >>
    >>--
    >>To unsubscribe, e-mail: [email]beginners-cgi-unsubscribe@perl.org[/email]
    >>For additional commands, e-mail: [email]beginners-cgi-help@perl.org[/email]
    >
    >
    >
    perl@swanmail.com Guest

  9. #8

    Default RE: cgi mail script anyone?

    > Thanks, you did good with this code for me. I did not want to
    > load more library as most suggested. This works just fine
    Why not? One simple use statement and you're done. Platform independent,
    No relying on an external program to be at the path you specify, use the switches you specify,
    Or use the data in the format you specify.

    I love Mail::Sender and I'm actually in the middle of a module that
    simplifies even using that (if you can imagine),

    Once done it will look like this:


    #/usr/bin/perl
    use strict;
    use warnings;
    use WhateverTheHeckICallTheModule qw(emailx);

    emailx({
    ip => '1.2.3.4',
    to => 'bob@some.com',
    fr => 'support@some.com',
    sb => 'Inquiry Response Request',
    ms => $emailmessagehere
    }) or die "No sendy mial $Error";

    You can even make it html and add attachment inline or attached with one simple hash entry.
    ht => $htmlversionhere,
    at => ...
    Much easier to read and you can use it on any server. There's even a
    way to ammke the smtp ip address automaytic so you don'tr have to put
    a different one in each script, via the Mail::Sender default data.


    For those interested kepp watching here:
    [url]http://search.cpan.org/~dmuey/[/url]

    HTH

    DMuey
    > with only one exception. I needed to use the -t option. Here
    > is the revised version which worked for
    > me:
    >
    > #/usr/bin/perl
    > use strict;
    > use warnings;
    >
    > my $mailprog = '/usr/sbin/sendmail -t'
    > my $empemail='bob@some.com';
    > my $inquirer='support@some.com';
    >
    > #EMAIL
    > open (MAIL, "|$mailprog") || die "Can't open mailprog.\n";
    > print MAIL "To: $empemail\n"; print MAIL "Reply-To:
    > $inquirer\n"; print MAIL "From: $inquirer\n"; print MAIL
    > "Subject: Inquiry Response Request\n\n"; print MAIL
    > <<"PrintTag"; Please respond to the following inquiry: blah
    > blah blah, message here PrintTag close(MAIL);
    >
    > --end code--
    >
    > > $mailprog = '/your/sendmail/path'
    > >
    > > #EMAIL
    > > open (MAIL, "|$mailprog") || die "Can't open mailprog.\n";
    > print MAIL
    > > "To: $empemail\n"; print MAIL "Reply-To: $inquirer\n";
    > > print MAIL "From: $inquirer\n";
    > > print MAIL "Subject: Inquiry Response Request\n\n";
    > > print MAIL <<"PrintTag";
    > > Please respond to the following inquiry:
    > > blah blah blah, message here
    > > PrintTag
    > > close(MAIL);
    > >
    > >
    > > At 07:14 PM 10/3/2003, you wrote:
    > >>I need to send a mail from the cgi. It must be able to have
    > a reply or
    > >>sender as someone different from the local web owner (apache). My
    > >>configuration:
    > >> redhat 9/qmail/vpopmail
    > >>
    > >> The example below will be typically what I want:
    > >>
    > >>To: [email]jdoe@some.com[/email]
    > >>From: [email]support@some.com[/email]
    > >>Subject: "hello support test"
    > >>this is a test
    > >>with all your support
    > >>
    > >>I see alot of parts but can't get it working.
    > >>can someone put a little script together that does this?
    > >>
    > >>thanks,
    > >>-rkl
    > >>
    > >>--
    > >>To unsubscribe, e-mail: [email]beginners-cgi-unsubscribe@perl.org[/email]
    > >>For additional commands, e-mail: [email]beginners-cgi-help@perl.org[/email]
    > >
    > >
    > >
    >
    >
    > --
    > To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    > For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    >
    >
    Dan Muey Guest

  10. #9

    Default RE: cgi mail script anyone?

    I am using NET::SSH::Perl. Login is correct. mkdir is correct. Yet when I
    try to pass a local file to remote host to copy file to newly created
    directory, it fails:

    code:
    use Net::SSH::Perl

    my $ssh = Net::SSH::Perl->new($host);
    $ssh->login($user, $pass);

    print $ssh->cmd("mkdir $site);
    print $ssh->cmd("cd $site); #does not change directory tested using
    "cmd("pwd")"
    print $ssh->cmd("cp $filename");

    etc...

    Any help would help.

    thanks in advance
    Richard

    -----Original Message-----
    From: Dan Muey [mailto:dmuey@infiniplex.com]
    Sent: Tuesday, October 07, 2003 12:35 PM
    To: [email]perl@swanmail.com[/email]; Teresa Raymond; [email]beginners@perl.org[/email];
    [email]beginners-cgi@perl.org[/email]
    Subject: RE: cgi mail script anyone?

    > Thanks, you did good with this code for me. I did not want to
    > load more library as most suggested. This works just fine
    Why not? One simple use statement and you're done. Platform independent,
    No relying on an external program to be at the path you specify, use the
    switches you specify,
    Or use the data in the format you specify.

    I love Mail::Sender and I'm actually in the middle of a module that
    simplifies even using that (if you can imagine),

    Once done it will look like this:


    #/usr/bin/perl
    use strict;
    use warnings;
    use WhateverTheHeckICallTheModule qw(emailx);

    emailx({
    ip => '1.2.3.4',
    to => 'bob@some.com',
    fr => 'support@some.com',
    sb => 'Inquiry Response Request',
    ms => $emailmessagehere
    }) or die "No sendy mial $Error";

    You can even make it html and add attachment inline or attached with one
    simple hash entry.
    ht => $htmlversionhere,
    at => ...
    Much easier to read and you can use it on any server. There's even a
    way to ammke the smtp ip address automaytic so you don'tr have to put
    a different one in each script, via the Mail::Sender default data.


    For those interested kepp watching here:
    [url]http://search.cpan.org/~dmuey/[/url]

    HTH

    DMuey
    > with only one exception. I needed to use the -t option. Here
    > is the revised version which worked for
    > me:
    >
    > #/usr/bin/perl
    > use strict;
    > use warnings;
    >
    > my $mailprog = '/usr/sbin/sendmail -t'
    > my $empemail='bob@some.com';
    > my $inquirer='support@some.com';
    >
    > #EMAIL
    > open (MAIL, "|$mailprog") || die "Can't open mailprog.\n";
    > print MAIL "To: $empemail\n"; print MAIL "Reply-To:
    > $inquirer\n"; print MAIL "From: $inquirer\n"; print MAIL
    > "Subject: Inquiry Response Request\n\n"; print MAIL
    > <<"PrintTag"; Please respond to the following inquiry: blah
    > blah blah, message here PrintTag close(MAIL);
    >
    > --end code--
    >
    > > $mailprog = '/your/sendmail/path'
    > >
    > > #EMAIL
    > > open (MAIL, "|$mailprog") || die "Can't open mailprog.\n";
    > print MAIL
    > > "To: $empemail\n"; print MAIL "Reply-To: $inquirer\n";
    > > print MAIL "From: $inquirer\n";
    > > print MAIL "Subject: Inquiry Response Request\n\n";
    > > print MAIL <<"PrintTag";
    > > Please respond to the following inquiry:
    > > blah blah blah, message here
    > > PrintTag
    > > close(MAIL);
    > >
    > >
    > > At 07:14 PM 10/3/2003, you wrote:
    > >>I need to send a mail from the cgi. It must be able to have
    > a reply or
    > >>sender as someone different from the local web owner (apache). My
    > >>configuration:
    > >> redhat 9/qmail/vpopmail
    > >>
    > >> The example below will be typically what I want:
    > >>
    > >>To: [email]jdoe@some.com[/email]
    > >>From: [email]support@some.com[/email]
    > >>Subject: "hello support test"
    > >>this is a test
    > >>with all your support
    > >>
    > >>I see alot of parts but can't get it working.
    > >>can someone put a little script together that does this?
    > >>
    > >>thanks,
    > >>-rkl
    > >>
    > >>--
    > >>To unsubscribe, e-mail: [email]beginners-cgi-unsubscribe@perl.org[/email]
    > >>For additional commands, e-mail: [email]beginners-cgi-help@perl.org[/email]
    > >
    > >
    > >
    >
    >
    > --
    > To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    > For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    >
    >
    --
    To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    Roberts Mr Richard L Guest

  11. #10

    Default RE: cgi mail script anyone?

    Is the $site directory actually created? What are it's permissions?
    Maybe you can

    $ssh->cmd("cp $site/$filename");

    But I thought cp required at least two args.

    -tristram

    -----Original Message-----
    From: Roberts Mr Richard L [mailto:ROBERTSRL@usmc-mccs.org]
    Sent: Tuesday, October 07, 2003 12:48 PM
    To: 'Dan Muey'; [email]perl@swanmail.com[/email]; Teresa Raymond; [email]beginners@perl.org[/email];
    [email]beginners-cgi@perl.org[/email]
    Subject: RE: cgi mail script anyone?


    I am using NET::SSH::Perl. Login is correct. mkdir is correct. Yet when
    I try to pass a local file to remote host to copy file to newly created
    directory, it fails:

    code:
    use Net::SSH::Perl

    my $ssh = Net::SSH::Perl->new($host);
    $ssh->login($user, $pass);

    print $ssh->cmd("mkdir $site);
    print $ssh->cmd("cd $site); #does not change directory tested using
    "cmd("pwd")" print $ssh->cmd("cp $filename");

    etc...

    Any help would help.

    thanks in advance
    Richard

    -----Original Message-----
    From: Dan Muey [mailto:dmuey@infiniplex.com]
    Sent: Tuesday, October 07, 2003 12:35 PM
    To: [email]perl@swanmail.com[/email]; Teresa Raymond; [email]beginners@perl.org[/email];
    [email]beginners-cgi@perl.org[/email]
    Subject: RE: cgi mail script anyone?

    > Thanks, you did good with this code for me. I did not want to
    > load more library as most suggested. This works just fine
    Why not? One simple use statement and you're done. Platform independent,

    No relying on an external program to be at the path you specify, use the
    switches you specify, Or use the data in the format you specify.

    I love Mail::Sender and I'm actually in the middle of a module that
    simplifies even using that (if you can imagine),

    Once done it will look like this:


    #/usr/bin/perl
    use strict;
    use warnings;
    use WhateverTheHeckICallTheModule qw(emailx);

    emailx({
    ip => '1.2.3.4',
    to => 'bob@some.com',
    fr => 'support@some.com',
    sb => 'Inquiry Response Request',
    ms => $emailmessagehere
    }) or die "No sendy mial $Error";

    You can even make it html and add attachment inline or attached with one
    simple hash entry.
    ht => $htmlversionhere,
    at => ...
    Much easier to read and you can use it on any server. There's even a
    way to ammke the smtp ip address automaytic so you don'tr have to put
    a different one in each script, via the Mail::Sender default data.


    For those interested kepp watching here: [url]http://search.cpan.org/~dmuey/[/url]

    HTH

    DMuey
    > with only one exception. I needed to use the -t option. Here
    > is the revised version which worked for
    > me:
    >
    > #/usr/bin/perl
    > use strict;
    > use warnings;
    >
    > my $mailprog = '/usr/sbin/sendmail -t'
    > my $empemail='bob@some.com';
    > my $inquirer='support@some.com';
    >
    > #EMAIL
    > open (MAIL, "|$mailprog") || die "Can't open mailprog.\n";
    > print MAIL "To: $empemail\n"; print MAIL "Reply-To:
    > $inquirer\n"; print MAIL "From: $inquirer\n"; print MAIL
    > "Subject: Inquiry Response Request\n\n"; print MAIL
    > <<"PrintTag"; Please respond to the following inquiry: blah
    > blah blah, message here PrintTag close(MAIL);
    >
    > --end code--
    >
    > > $mailprog = '/your/sendmail/path'
    > >
    > > #EMAIL
    > > open (MAIL, "|$mailprog") || die "Can't open mailprog.\n";
    > print MAIL
    > > "To: $empemail\n"; print MAIL "Reply-To: $inquirer\n"; print MAIL
    > > "From: $inquirer\n"; print MAIL "Subject: Inquiry Response
    > > Request\n\n"; print MAIL <<"PrintTag";
    > > Please respond to the following inquiry:
    > > blah blah blah, message here
    > > PrintTag
    > > close(MAIL);
    > >
    > >
    > > At 07:14 PM 10/3/2003, you wrote:
    > >>I need to send a mail from the cgi. It must be able to have
    > a reply or
    > >>sender as someone different from the local web owner (apache). My
    > >>configuration:
    > >> redhat 9/qmail/vpopmail
    > >>
    > >> The example below will be typically what I want:
    > >>
    > >>To: [email]jdoe@some.com[/email]
    > >>From: [email]support@some.com[/email]
    > >>Subject: "hello support test"
    > >>this is a test
    > >>with all your support
    > >>
    > >>I see alot of parts but can't get it working.
    > >>can someone put a little script together that does this?
    > >>
    > >>thanks,
    > >>-rkl
    > >>
    > >>--
    > >>To unsubscribe, e-mail: [email]beginners-cgi-unsubscribe@perl.org[/email]
    > >>For additional commands, e-mail: [email]beginners-cgi-help@perl.org[/email]
    > >
    > >
    > >
    >
    >
    > --
    > To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    > For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    >
    >
    --
    To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    For additional commands, e-mail: [email]beginners-help@perl.org[/email]

    --
    To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    For additional commands, e-mail: [email]beginners-help@perl.org[/email]

    Tn Guest

  12. #11

    Default RE: cgi mail script anyone?

    the code:
    $ssh->cmd("mkdir $direct");
    functions as directory '$direct' is created,

    yet my next line of code:
    $ssh->cmd("cd $direct"); chokes as I run next line to confirm:
    $ssh->cmd("pwd"); shows no directory change, still in parent directory

    thus when I run:
    $ssh->cmd("cp $file1 $file2");
    gets no responce i.e. no file is copied.

    Does that makes sence?

    sierrasurf

    -----Original Message-----
    From: TN [mailto:tn@eldan.cc]
    Sent: Tuesday, October 07, 2003 1:10 PM
    To: 'Roberts Mr Richard L'
    Cc: 'Dan Muey'; [email]perl@swanmail.com[/email]; 'Teresa Raymond'; [email]beginners@perl.org[/email];
    [email]beginners-cgi@perl.org[/email]
    Subject: RE: cgi mail script anyone?


    Is the $site directory actually created? What are it's permissions?
    Maybe you can

    $ssh->cmd("cp $site/$filename");

    But I thought cp required at least two args.

    -tristram

    -----Original Message-----
    From: Roberts Mr Richard L [mailto:ROBERTSRL@usmc-mccs.org]
    Sent: Tuesday, October 07, 2003 12:48 PM
    To: 'Dan Muey'; [email]perl@swanmail.com[/email]; Teresa Raymond; [email]beginners@perl.org[/email];
    [email]beginners-cgi@perl.org[/email]
    Subject: RE: cgi mail script anyone?


    I am using NET::SSH::Perl. Login is correct. mkdir is correct. Yet when
    I try to pass a local file to remote host to copy file to newly created
    directory, it fails:

    code:
    use Net::SSH::Perl

    my $ssh = Net::SSH::Perl->new($host);
    $ssh->login($user, $pass);

    print $ssh->cmd("mkdir $site);
    print $ssh->cmd("cd $site); #does not change directory tested using
    "cmd("pwd")" print $ssh->cmd("cp $filename");

    etc...

    Any help would help.

    thanks in advance
    Richard

    -----Original Message-----
    From: Dan Muey [mailto:dmuey@infiniplex.com]
    Sent: Tuesday, October 07, 2003 12:35 PM
    To: [email]perl@swanmail.com[/email]; Teresa Raymond; [email]beginners@perl.org[/email];
    [email]beginners-cgi@perl.org[/email]
    Subject: RE: cgi mail script anyone?

    > Thanks, you did good with this code for me. I did not want to
    > load more library as most suggested. This works just fine
    Why not? One simple use statement and you're done. Platform independent,

    No relying on an external program to be at the path you specify, use the
    switches you specify, Or use the data in the format you specify.

    I love Mail::Sender and I'm actually in the middle of a module that
    simplifies even using that (if you can imagine),

    Once done it will look like this:


    #/usr/bin/perl
    use strict;
    use warnings;
    use WhateverTheHeckICallTheModule qw(emailx);

    emailx({
    ip => '1.2.3.4',
    to => 'bob@some.com',
    fr => 'support@some.com',
    sb => 'Inquiry Response Request',
    ms => $emailmessagehere
    }) or die "No sendy mial $Error";

    You can even make it html and add attachment inline or attached with one
    simple hash entry.
    ht => $htmlversionhere,
    at => ...
    Much easier to read and you can use it on any server. There's even a
    way to ammke the smtp ip address automaytic so you don'tr have to put
    a different one in each script, via the Mail::Sender default data.


    For those interested kepp watching here: [url]http://search.cpan.org/~dmuey/[/url]

    HTH

    DMuey
    > with only one exception. I needed to use the -t option. Here
    > is the revised version which worked for
    > me:
    >
    > #/usr/bin/perl
    > use strict;
    > use warnings;
    >
    > my $mailprog = '/usr/sbin/sendmail -t'
    > my $empemail='bob@some.com';
    > my $inquirer='support@some.com';
    >
    > #EMAIL
    > open (MAIL, "|$mailprog") || die "Can't open mailprog.\n";
    > print MAIL "To: $empemail\n"; print MAIL "Reply-To:
    > $inquirer\n"; print MAIL "From: $inquirer\n"; print MAIL
    > "Subject: Inquiry Response Request\n\n"; print MAIL
    > <<"PrintTag"; Please respond to the following inquiry: blah
    > blah blah, message here PrintTag close(MAIL);
    >
    > --end code--
    >
    > > $mailprog = '/your/sendmail/path'
    > >
    > > #EMAIL
    > > open (MAIL, "|$mailprog") || die "Can't open mailprog.\n";
    > print MAIL
    > > "To: $empemail\n"; print MAIL "Reply-To: $inquirer\n"; print MAIL
    > > "From: $inquirer\n"; print MAIL "Subject: Inquiry Response
    > > Request\n\n"; print MAIL <<"PrintTag";
    > > Please respond to the following inquiry:
    > > blah blah blah, message here
    > > PrintTag
    > > close(MAIL);
    > >
    > >
    > > At 07:14 PM 10/3/2003, you wrote:
    > >>I need to send a mail from the cgi. It must be able to have
    > a reply or
    > >>sender as someone different from the local web owner (apache). My
    > >>configuration:
    > >> redhat 9/qmail/vpopmail
    > >>
    > >> The example below will be typically what I want:
    > >>
    > >>To: [email]jdoe@some.com[/email]
    > >>From: [email]support@some.com[/email]
    > >>Subject: "hello support test"
    > >>this is a test
    > >>with all your support
    > >>
    > >>I see alot of parts but can't get it working.
    > >>can someone put a little script together that does this?
    > >>
    > >>thanks,
    > >>-rkl
    > >>
    > >>--
    > >>To unsubscribe, e-mail: [email]beginners-cgi-unsubscribe@perl.org[/email]
    > >>For additional commands, e-mail: [email]beginners-cgi-help@perl.org[/email]
    > >
    > >
    > >
    >
    >
    > --
    > To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    > For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    >
    >
    --
    To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    For additional commands, e-mail: [email]beginners-help@perl.org[/email]

    --
    To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    Roberts Mr Richard L Guest

  13. #12

    Default RE: cgi mail script anyone?

    I have full permissions as earlier code creates new dir: $site, yet when I
    try to 'cd' or even 'cwd' notta thus when I try to cp $ssh->cmd("cp $file
    20020922"); it bombs.

    -----Original Message-----
    From: TN [mailto:tn@eldan.cc]
    Sent: Tuesday, October 07, 2003 1:10 PM
    To: 'Roberts Mr Richard L'
    Cc: 'Dan Muey'; [email]perl@swanmail.com[/email]; 'Teresa Raymond'; [email]beginners@perl.org[/email];
    [email]beginners-cgi@perl.org[/email]
    Subject: RE: cgi mail script anyone?


    Is the $site directory actually created? What are it's permissions?
    Maybe you can

    $ssh->cmd("cp $site/$filename");

    But I thought cp required at least two args.

    -tristram

    -----Original Message-----
    From: Roberts Mr Richard L [mailto:ROBERTSRL@usmc-mccs.org]
    Sent: Tuesday, October 07, 2003 12:48 PM
    To: 'Dan Muey'; [email]perl@swanmail.com[/email]; Teresa Raymond; [email]beginners@perl.org[/email];
    [email]beginners-cgi@perl.org[/email]
    Subject: RE: cgi mail script anyone?


    I am using NET::SSH::Perl. Login is correct. mkdir is correct. Yet when
    I try to pass a local file to remote host to copy file to newly created
    directory, it fails:

    code:
    use Net::SSH::Perl

    my $ssh = Net::SSH::Perl->new($host);
    $ssh->login($user, $pass);

    print $ssh->cmd("mkdir $site);
    print $ssh->cmd("cd $site); #does not change directory tested using
    "cmd("pwd")" print $ssh->cmd("cp $filename");

    etc...

    Any help would help.

    thanks in advance
    Richard

    -----Original Message-----
    From: Dan Muey [mailto:dmuey@infiniplex.com]
    Sent: Tuesday, October 07, 2003 12:35 PM
    To: [email]perl@swanmail.com[/email]; Teresa Raymond; [email]beginners@perl.org[/email];
    [email]beginners-cgi@perl.org[/email]
    Subject: RE: cgi mail script anyone?

    > Thanks, you did good with this code for me. I did not want to
    > load more library as most suggested. This works just fine
    Why not? One simple use statement and you're done. Platform independent,

    No relying on an external program to be at the path you specify, use the
    switches you specify, Or use the data in the format you specify.

    I love Mail::Sender and I'm actually in the middle of a module that
    simplifies even using that (if you can imagine),

    Once done it will look like this:


    #/usr/bin/perl
    use strict;
    use warnings;
    use WhateverTheHeckICallTheModule qw(emailx);

    emailx({
    ip => '1.2.3.4',
    to => 'bob@some.com',
    fr => 'support@some.com',
    sb => 'Inquiry Response Request',
    ms => $emailmessagehere
    }) or die "No sendy mial $Error";

    You can even make it html and add attachment inline or attached with one
    simple hash entry.
    ht => $htmlversionhere,
    at => ...
    Much easier to read and you can use it on any server. There's even a
    way to ammke the smtp ip address automaytic so you don'tr have to put
    a different one in each script, via the Mail::Sender default data.


    For those interested kepp watching here: [url]http://search.cpan.org/~dmuey/[/url]

    HTH

    DMuey
    > with only one exception. I needed to use the -t option. Here
    > is the revised version which worked for
    > me:
    >
    > #/usr/bin/perl
    > use strict;
    > use warnings;
    >
    > my $mailprog = '/usr/sbin/sendmail -t'
    > my $empemail='bob@some.com';
    > my $inquirer='support@some.com';
    >
    > #EMAIL
    > open (MAIL, "|$mailprog") || die "Can't open mailprog.\n";
    > print MAIL "To: $empemail\n"; print MAIL "Reply-To:
    > $inquirer\n"; print MAIL "From: $inquirer\n"; print MAIL
    > "Subject: Inquiry Response Request\n\n"; print MAIL
    > <<"PrintTag"; Please respond to the following inquiry: blah
    > blah blah, message here PrintTag close(MAIL);
    >
    > --end code--
    >
    > > $mailprog = '/your/sendmail/path'
    > >
    > > #EMAIL
    > > open (MAIL, "|$mailprog") || die "Can't open mailprog.\n";
    > print MAIL
    > > "To: $empemail\n"; print MAIL "Reply-To: $inquirer\n"; print MAIL
    > > "From: $inquirer\n"; print MAIL "Subject: Inquiry Response
    > > Request\n\n"; print MAIL <<"PrintTag";
    > > Please respond to the following inquiry:
    > > blah blah blah, message here
    > > PrintTag
    > > close(MAIL);
    > >
    > >
    > > At 07:14 PM 10/3/2003, you wrote:
    > >>I need to send a mail from the cgi. It must be able to have
    > a reply or
    > >>sender as someone different from the local web owner (apache). My
    > >>configuration:
    > >> redhat 9/qmail/vpopmail
    > >>
    > >> The example below will be typically what I want:
    > >>
    > >>To: [email]jdoe@some.com[/email]
    > >>From: [email]support@some.com[/email]
    > >>Subject: "hello support test"
    > >>this is a test
    > >>with all your support
    > >>
    > >>I see alot of parts but can't get it working.
    > >>can someone put a little script together that does this?
    > >>
    > >>thanks,
    > >>-rkl
    > >>
    > >>--
    > >>To unsubscribe, e-mail: [email]beginners-cgi-unsubscribe@perl.org[/email]
    > >>For additional commands, e-mail: [email]beginners-cgi-help@perl.org[/email]
    > >
    > >
    > >
    >
    >
    > --
    > To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    > For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    >
    >
    --
    To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    For additional commands, e-mail: [email]beginners-help@perl.org[/email]

    --
    To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    For additional commands, e-mail: [email]beginners-help@perl.org[/email]


    --
    To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    Roberts Mr Richard L Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139