Bold field names in e-mail

NateMail, ProcessForm, JavaScript Form Validator, Form Security, etc.

Bold field names in e-mail

Postby pcob » 04/24/2009 @ 13:51

I would like to know how to format the field names in the actual email as BOLD. I am using NateMail and see the formatting for the confirmation page. I would like to duplicate that in the actual email. Any suggestions?
pcob
 
Posts: 10
Joined: 11/29/2007 @ 15:34

Re: Bold field names in e-mail

Postby kurtlane » 04/29/2009 @ 05:10

Hello,

I use process form not natemail, but it would be similar. I have Natemail on my PC so ill just check it for you. First I had to change the email that gets sent you when someone fills out the form, basically change it from plain text email to text/html email, in natemail you have to edit it,

Natemail Paste this before 631 (Processform paste this before 1052)
(above this $headers = $MPSender.$headers;)

Code: Select all
$headers = "MIME-Version: 1.0rn$le";
$headers .= "Content-type: text/html; charset=iso-8859-1rn$le";


That makes the emial you recieve a html email not plain text.

Then on 612 of natemail it has $emailNameVals = "";

I changed it to
Code: Select all
$emailNameVals = "<br><br><font face=\"Arial\" style=\"font-weight:bold\">";

Dont forget to close the font tage on 621 before the ---- change it to
Code: Select all
         
$MPEmailBody .= "</font>-------------------------------------------------------$le $le";


or change 617 to this

Code: Select all
"<font face=\"Arial\" style=\"font-weight:bold\">".$thisFieldName."</font>: ".$thisFieldValue.$emailSepChars."<br><br>";

if you just want $thisFieldName (field name) to be bold like you asked for.
Get it, its PHP html code that makes the resulting html email styled. You can add other stuff like pictures, hyperlinks etc..

Hope this helps.
kurtlane
 
Posts: 8
Joined: 04/29/2009 @ 04:56

Re: Bold field names in e-mail

Postby pcob » 04/29/2009 @ 13:51

The code you sent gets the bold into the complete e-mail with no seperation. I want the e-mail body to look similar to the confirmation page. The Field Names in the Confirmation Page are bold and the fields are normal font. The HTML you sent also runs Field Names and fields all into one. I know I am missing something simple. Thanks for your help.

Confirmation Page
Meeting Date: test

Agenda Item: test

Requesting Agency: test

Background: test

Staff Recommendation: test

Recommended Motion: test

E-mail body:
Meeting Datetest Agenda Itemtest Requesting Agencytest Backgroundtest Staff Recommendationtest Recommended Motiontest
pcob
 
Posts: 10
Joined: 11/29/2007 @ 15:34

Re: Bold field names in e-mail

Postby kurtlane » 04/29/2009 @ 14:36

I know when I did the above, they all ran into one line until I added a few more html Line breaks into it - <br>, in the right place, that fixed it. Maybe someone else can help, but my code looks like this -

Code: Select all
// Send out email if recipients were found...
      if (count($recipientArray) > 0) {
         $MPEmailBody = "<font face=\"Arial\">The following information was submitted from the website on $dateTime:$le$le<br><br>";
         $MPEmailBody .= "-------------------------------------------------------$le$le";
         $emailSepChars = ($doubleSpaceEmail == true) ? "$le$le" : "$le";
         $emailNameVals = "<br><br><font face=\"Arial\" style=\"font-weight:bold\">";
         for ($n=0; $n<count($emailArray); $n++) {
            if ($emailArray[$n]['value'] != "") {
               $thisFieldName = MPAdjustFields(stripslashes($emailArray[$n]['key']));
               $thisFieldValue = stripslashes($emailArray[$n]['value']);
               $emailNameVals .= $thisFieldName.": ".$thisFieldValue.$emailSepChars."<br><br>";
               }
            }
         $MPEmailBody .= $emailNameVals;
         $MPEmailBody .= "</font>-------------------------------------------------------</font>$le $le";
         $MPEmailBody = $attachStart.$MPEmailBody.$attachFile;
         if ($MPForceSender == '') {
            $MPSender = "";
            $sender_email = (isset($MPPostVars[$sender_email])) ? $MPPostVars[$sender_email] : "";
            if ($sender_email != "") $sender_email = (eregi($emailPattern, $sender_email)) ? $sender_email : "";
            $sender_name = (isset($MPPostVars[$sender_name])) ? $MPPostVars[$sender_name] : "";
            if ($sender_email != "") {
               $MPSender = ($sender_name != "") ? stripslashes($sender_name)." <".stripslashes($sender_email).">" : stripslashes($sender_email);
               }
            if ($MPSender != "") $MPSender = "From: $MPSender$le";
            $headers = "MIME-Version: 1.0rn$le";
            $headers .= "Content-type: text/html; charset=iso-8859-1rn$le";
            $headers = $MPSender.$headers;


Im using processform, but just changing my code above slightly to this I achive BOLD field names in the resulting email.
Code: Select all
      // Send out email if recipients were found...
      if (count($recipientArray) > 0) {
         $MPEmailBody = "<font face=\"Arial\">The following information was submitted from the website on $dateTime:$le$le<br><br>";
         $MPEmailBody .= "-------------------------------------------------------$le$le";
         $emailSepChars = ($doubleSpaceEmail == true) ? "$le$le" : "$le";
         $emailNameVals = "<br><br>";
         for ($n=0; $n<count($emailArray); $n++) {
            if ($emailArray[$n]['value'] != "") {
               $thisFieldName = MPAdjustFields(stripslashes($emailArray[$n]['key']));
               $thisFieldValue = stripslashes($emailArray[$n]['value']);
               $emailNameVals .= "<font face=\"Arial\" style=\"font-weight:bold\">".$thisFieldName."</font>: ".$thisFieldValue.$emailSepChars."<br><br>";
               }
            }
         $MPEmailBody .= $emailNameVals;
         $MPEmailBody .= "-------------------------------------------------------</font>$le $le";
         $MPEmailBody = $attachStart.$MPEmailBody.$attachFile;
         if ($MPForceSender == '') {
            $MPSender = "";
            $sender_email = (isset($MPPostVars[$sender_email])) ? $MPPostVars[$sender_email] : "";
            if ($sender_email != "") $sender_email = (eregi($emailPattern, $sender_email)) ? $sender_email : "";
            $sender_name = (isset($MPPostVars[$sender_name])) ? $MPPostVars[$sender_name] : "";
            if ($sender_email != "") {
               $MPSender = ($sender_name != "") ? stripslashes($sender_name)." <".stripslashes($sender_email).">" : stripslashes($sender_email);
               }
            if ($MPSender != "") $MPSender = "From: $MPSender$le";
            $headers = "MIME-Version: 1.0rn$le";
            $headers .= "Content-type: text/html; charset=iso-8859-1rn$le";
            $headers = $MPSender.$headers;


Maybe Im not understanding you?
kurtlane
 
Posts: 8
Joined: 04/29/2009 @ 04:56

Re: Bold field names in e-mail

Postby pcob » 04/29/2009 @ 14:57

I got the line spacing to work. Thank you for the code. I now have bold field names in the email and proper spacing. The field data is also coming in bold. Is there a way to get that in the normal font with the field names bold? I know, I am being picky! Thanks for all your help.
pcob
 
Posts: 10
Joined: 11/29/2007 @ 15:34

Re: Bold field names in e-mail

Postby kurtlane » 04/29/2009 @ 15:40

Yes, use the second lot of code in my last post, (but remember its for processform becuase it has the ability to send attatchments also, a nice feature, but there is extra code in there that Natemail wont need), But basically see below

in the php variable $emailNameVals, the variable that contains the field names - $thisFieldName, is surrounded by the font tag for arial font and bold. It is closed </font> after $thisFieldName, so the contents of the variable will be in bold, but not the variables that come after in this script $thisFieldValue & $emailSepChars, these will be in Arial only.

Code: Select all
$emailNameVals .= "<font face=\"Arial\" style=\"font-weight:bold\">".$thisFieldName."</font>: ".$thisFieldValue.$emailSepChars."<br><br>";


The rest of the email is only surrounded by <font face=\"Arial\"> the closing tag for this is after the ---- at the end of the email. Still having problems? Paste your code here and I will edit it.
kurtlane
 
Posts: 8
Joined: 04/29/2009 @ 04:56

Re: Bold field names in e-mail

Postby pcob » 04/30/2009 @ 09:39

That did it. Thank you.
I work on the programming so seldom that the little details slip right past me.
pcob
 
Posts: 10
Joined: 11/29/2007 @ 15:34


Return to Form Processing (NateMail, ProcessForm)



Who is online

Users browsing this forum: No registered users and 4 guests

cron