Forum Moderators: coopster & phranque

Message Too Old, No Replies

how to add variable to subject line in NMS Formail

want to add sender's email address to the subject line of the email

         

Ceyx

6:36 am on Dec 10, 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.

Thanks in advance for any help!
Peter

lexipixel

7:31 am on Dec 10, 2006 (gmt 0)

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



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';

Ceyx

11:08 am on Dec 10, 2006 (gmt 0)

10+ Year Member



Thanks. I tried both ways you 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?

lexipixel

5:55 pm on Dec 11, 2006 (gmt 0)

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



The line:

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

says:

Please let the variable $subject equal the value of the variable $Config{subject}, or if the variable $Config{subject} is undefined or has no value let the variable $subject equal 'WWW Form Submission'.

To answer your question:

How to have words and a variable's value as the value of $subject...

try:

my $subject = 'WWW Form Submission ' . $Config{subject} ¦¦ 'WWW Form Submission (no email provided)';

or:

my $subject = 'Sign Up: ' . $Config{subject} ¦¦ 'Sign Up: (no email)';

etc..