Include senders name in subject line

I recently had the following question from a FCF user:

QUESTION

‘I am wanting to slightly modify the subject line with the sender’s name included. Can you please let me know how this can be done?’

ANSWER

This requires very slight modification to one of the scripts (process_form.php).

Step One:

Open process_form.php in your favorite text/script editor.

Step Two:

Go-to line number 159 (with the line: // create email headers)

Step Three:

Create a new line under line number 159, and enter the following:

$email_subject .= " ".$_POST['fullname'];

Step Four:

Save the file and upload to your server (overwrite the original process_form.php file if it already exists)

What the above script modification will do

The example given above will append the form senders ‘fullname’ to the end of the subject line. Keep in mind that you already can configure the subject line in config.php (around line 34).

If you want to make the subject line have the senders name inside the subject line (i.e. not at the end of the subject line), then change the above code in Step Three to something like:

$email_subject = $_POST['fullname']." sent you a message";

The above will make the subject like look like:

Trevor McDonald sent you a message

(if the senders name is Trever McDonald)

This post will hopefully give you an idea of how to make some simple changes to your contact us form. This is based on FCF Version 3 Beta 2!

If you want to know how to do something with FCF - drop me a message!

Leave a Reply

You must be logged in to post a comment.