Formmail Help - Need to show sender's e-mail

Discussion in 'PHP' started by TonyinPa, Jul 6, 2008.

  1. #1
    Greetings All:
    My web host has a formmail script that I use so visitors to the website can submit information via e-mail. the problem is when the e-mail comes through to my inbox, it comes from our default general e-mail address <postmaster@soandso.com>.

    I'd like to configure our script so that the e-mail will show who the form is actually coming from.

    Any help is appreciated.

    Tony
     
    TonyinPa, Jul 6, 2008 IP
  2. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #2
    Open the formail script and replace with the variable holding sender's email address.
     
    mwasif, Jul 6, 2008 IP
  3. TonyinPa

    TonyinPa Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I'm very new to this. I didn't write the script, but am using the one provided by our web host.

    Here's what the script looks like...

    sub send_mail {
    # Localize variables used in this subroutine. #
    local($print_config,$key,$sort_order,$sorted_field,$env_report);

    if (!$Config{'email'}) { $Config{'email'} = "postmaster\@insuranceforvolunteers.com"; }
    if (!$Config{'recipient'}) { $Config{'recipient'} = "postmaster\@insuranceforvolunteers.com"; }

    What variable can I use to change the e-mail to show the e-mail address from whoever sends in a form?
     
    TonyinPa, Jul 6, 2008 IP
  4. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #4
    One solution:

    http://danltn.com/bin/o0q.phps

    Save that to 'mail.php';

    Then:

    <?php
    
    require_once 'mail.php';
    
    $mail = new email;
    
    $html_mail = true;
    $to = 'them@them.com';
    $subject = 'Subject';
    $message = 'Message';
    $you = 'your@email.com';
    
    $mail->html_mail($html_mail)->to($to)->subject($subject)->message($message)->from($you)->send();
    
    PHP:
     
    Danltn, Jul 6, 2008 IP
  5. TonyinPa

    TonyinPa Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    OK, I'm willing to try it, but am completely lost... I know nothing about this stuff...
    the link you sent me should be added to my cgi bin...
    then how do I link the formmail.pl already there to the mail.php that you provided?
     
    TonyinPa, Jul 6, 2008 IP
  6. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #6
    Formmail.pl is perl...

    Are you trying to program in PHP or Perl here?

    Mixing two languages in one program is an awful coding style.

    Dan
     
    Danltn, Jul 6, 2008 IP
  7. TonyinPa

    TonyinPa Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Perl. My web host provides the script (Matt's).
     
    TonyinPa, Jul 6, 2008 IP