Would love this too – or at least have the subject have the form name/id embedded in it
You can specify the default subject easily (see below). I haven’t found out how to customize it as a single use per form, which of course would be more useful.
In the plugin admin/General Settings:
Enter your default email subject
——————————
Default Email Subject:
Default subject to be included in all form emails.
———————
I am looking for how to customize the From Name Email. This option is not available as a default OR as a single use form option.
Shim.sim
Hi I had a simliar problem (or requirement).
I am no WordPress Expert but I made a little mod to the custom contact forms code to allow it to use a form variable as part of the subject.
I am no PHP expert either! Although this mod works for me please make sure you take a backup before trying it.
1. Take a backup of wp-content/plugins/custom-contact-forms/custom-contact-forms-front.php
2. Edit the file and locate the lines as follows;
$mail->AltBody = __("To view the message, please use an HTML compatible email viewer.", 'custom-contact-forms');
$mail->CharSet = 'utf-8';
$mail->MsgHTML(stripslashes($body));
$mail->Send();
Which starts around 453 in my install (CCF Version 4.5.2.1)
3. Insert the following code before the code in point 2
/* start of insert code to allow form variables in email subject */
$subjectwords=explode(" ",$mail->Subject);
foreach($subjectwords as &$thisword){
if(substr($thisword,0,1) == '%' and substr($thisword,-1,1) == '%') {
$key = trim($thisword,'%');
$thisword = $data_array[$key];
}
}
$mail->Subject = implode(" ",$subjectwords);
/* end of insert code to allow form variables in email subject */
4. Ok now you can insert one of your form variable names into the subject of your mail between % signs – like %ccf_fromname%
Now I couldnt find this parm, but it is in the MYSQL table <prefix>_customcontactforms_forms – you should a row for each form you have, and if you edit with phpmyadmin you can see the subject in column ‘form_email_subject’
5. Voila!
If you are comfortable around phpmyadmin and a bit of code editing it should be no trouble – you can use a similar technique to modify the fromname etc etc.
I hope that helps
PS: Backup Backup Backup!!!!
Dave,
Just read you comment too – I did this by modifying the column ‘form_email_name’ in table <prefix>_customcontactforms_forms.
If you want it to be based upon a form variable then you could adapt my code above to make a similar behavior.
Simon
BrusselsExpats solution works great for idividiual fileds, but I’d like to customize my subject line based on a slection from a dropdown list. I would really appreciate if someone could post the code, because I have no PHP programming experince and have no clue how to change the code.
Huge thanks in advance gusy!