Forum Moderators: mack

Message Too Old, No Replies

Need help scripting NMS FormMail

Want to customize Subject line with email variable

         

Ceyx

2:38 am on Dec 11, 2006 (gmt 0)

10+ Year Member



I am using NMS FormMail.pl and want the email address of the form's sender to appear in the SUBJECT line of email I receive. How do I do this?

There is a line in the script:

my $subject = $Config{subject}? 'WWW Form Submission';

and "WWW Form Submission" is what appears in the SUBJECT line of the email I receive. I would like it to say "WWW Form Submission from sender@theirdomain.com".

something like how this line from the script:

Below is the result of your feedback form. It was submitted by
$Config{realname} (${\( $Config{email}?'' )}) on $date

puts their email, date etc. into the BODY of the email.

Some one suggested this:

add the line:

$Config{subject} = $Config{email};

just before the line:

my $subject = $Config{subject}? 'WWW Form Submission';

or, change the line:

my $subject = $Config{subject}? 'WWW Form Submission';

to:

my $subject = $Config{email}? 'No Email Address Found';

* but:

I tried both ways suggested and either way I just get the email address with no other words as the subject line, i.e. I don't get "WWW Form Submission myemailaddress@mydomain.com" or "No Email Address Found myemailaddress@mydomain.com". How can I add extra words before or after the email address in the subject line?

Thanks in advance for any help!
Peter

MichaelBluejay

9:50 am on Dec 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What you want is to combine the two variables, the subject and the email address. You do this with a dot. For example:

$a = 'apple';
$b = 'banana';
$c = $a . $b;

$c would then equal "applebanana".

So it should work to do:

my $subject = 'WWW Form Submission from ' . $Config{email};

What I don't understand is those question marks in your code, or why you have $subject = $Config.... rather than just $subject = 'WWW.... I'm a Perl guy, not really versed in PHP.