Web2Lead Form - what's the Lead email variable for an email template?

Hello,

we’re trying to do sth pretty basic:
A lead fills out a form on the website, data is floating into the system, a workflow is triggered sends an email to us and to the lead with the entered data.
Everything is working smooth BUT the email.
I used those variables:

1. $lead_webtolead_email1
2. $lead_email
3. $lead_email1
4. $emailaddress_email_address
5. $lead_email_addresses_non_primary
6. $lead_webtolead_email2

The numbers are showing, but no email at all.

Other values like:

$lead_last_name

are working fine as well.
So I might just use the wrong email?

The HTML form is:

<div class="form-group"> <input class="form-control" id="email1" name="email1"
                onchange="validateEmailAdd();" placeholder="Your Email" type="text" tabindex="4" required>

Hope someone can help there

Thanks,
Chris

the email field is called email1
so you should use


$_REQUEST['email1']

or $email1

or $bean->email1

depending on the situation
(obviously you have to adpt to what you have done, so you should put the actual name of the bean variable or the actual name of the email variable if you have defined it in a different way.

None of them are working.
I’m inside SuiteCRM in the mail templates:
/index.php?module=EmailTemplates&action=index

I am not sure of what you are trying to do.
However, after further investigation the web to lead email variable returned by the web to lead form is called:

$webtolead_email1

I want to send an email via a worfklow after somebody filled the web2lead form, pressed the submit button and the lead is being created in the CRM.

The workflow is being triggered.
The mail is being sent out.
All variables in the mail templates are working:

Hello $lead_first_name,
Your company Name: $lead_account_name
etc.
Your email:
is always empty.

$webtolead_email1
$_REQUEST[‘email1’]
$email1
$bean->email1
$lead_webtolead_email1
$lead_email
$lead_email1
$emailaddress_email_address
$lead_email_addresses_non_primary
$lead_webtolead_email2

all these variable don’t contain the email.
So there must be sth. wrong?

I am pasting below a hack to the file modules/campaigns/WebToLeadtCapture.php

This hack lists the fields captured in the form and sends an email to a defined list of recipients.

Maybe it can be of help to understand the issue.

// Web to lead capture notification email
// *************************************************************************************************
// *************************************************************************************************
// ********** Work around to send email when a lead is captured from Web to Lead Form **************
// *************************************************************************************************
// *************************************************************************************************
// File to be modified: modules/campaigns/WebToLeadtCapture.php
//
// IMPORTANT!
// Before pasting this portion of code you must create the following custom fields: notify_emails_c (users must enter a comma separated list of emails who will receive the notification), notify_email_sender_name_c (name of email sender), notify_email_sender_email_c (email address of sender), notify_email_subject_c (subject of message) from Admin->Studio in the Campaigns Module and add them to the Edit View
//
// If you want to send notification emails when a new Web Lead is captured you must fill at least the notify_emails_c field in the campaign edit form
//
// This code must be inserted between the lines:
//
//				if(empty($lead)) {
//					if($first_iteration){
//						$query_string .= $first_char;
//					}
//					else{
//						$query_string .= "&";
//					}
//					$query_string .= "error=1";
//				}
//
// and the line:
//
//				$redirect_url = $redirect_url.$query_string;

 		    $WA_query = "";
		    $WA_To_email_address = "";

				$WA_My_email_message="";
				$WA_email_string = substr($query_string, 1);
				$WA_pairs=array();
				$WA_pairs = explode("&", $WA_email_string);

        // create the message listing all the fields in the from with their respective values
				foreach ($WA_pairs as $WA_one_pair)
				  {
				    list($WA_this_key, $WA_this_value) = explode("=", $WA_one_pair);

				    // Get the notification emails for this campaign
				    if (htmlspecialchars(urldecode(trim($WA_this_key))) == "campaign_id")
				      {
                $WA_query = "SELECT * FROM campaigns_cstm WHERE id_c = '".htmlspecialchars(urldecode(trim($WA_this_value)))."'";
                $WA_db = DBManagerFactory::getInstance();
            		$WA_result = $WA_db->query($WA_query, 0, 1, true);
            		if(!empty($WA_result))
			   {
		                $WA_result_fields = $WA_db->fetchByAssoc($WA_result);
		                $WA_To_email_address = $WA_result_fields['notify_emails_c'];
		                $WA_From_name = $WA_result_fields['notify_email_sender_name_c'];
		                $WA_From_email_address = $WA_result_fields['notify_email_sender_email_c'];
		                $WA_email_subject = $WA_result_fields['notify_email_subject_c'];
			   }
				        unset($WA_db);
				      }
				    $WA_My_email_message .= $WA_this_key . ": " . htmlspecialchars(urldecode(trim($WA_this_value))) . "\r\n";
				  }

				// Send notification email only if the notification emails were set in the campaign
				if ($WA_To_email_address <> "")
				  {
            // Prepare the email
            // In case you want to hard code the email address here and not in the campaign you must uncomment and set the following lines
//				    $WA_To_email_address = "your_to@email.com";
//		    		$WA_email_subject = "Notification email subject";
//				    $WA_From_email_address = "your_from@email.com";
//			    	$WA_From_name = "Name of from email";

            if ($WA_From_email_address <> "")
				      {
				        $WA_From_header  = (($WA_From_name <> "") ? "From: " . $WA_From_name . " " : "From: SugarCRM Web to lead form");
    				    $WA_From_header .= "<" . $WA_From_email_address . ">\r\n";
				      }
				    else
				      $WA_From_header = "";
				    
				    // Send the email
				    mail($WA_To_email_address, $WA_email_subject, $WA_My_email_message, $WA_From_header);
				  }

// *************************************************************************************************
// *************************************************************************************************
// *************************************************************************************************
// *************************************************************************************************

One more thing: from reading the file modules/Campaigns/WebToLeadCapture.php, at a certain point there is the following portion of code:


		        if (isset($_POST['email1']) && $_POST['email1'] != null)
                {
                    $lead->email1 = $_POST['email1'];
		        } 
                //in case there are old forms used webtolead_email1
                elseif (isset($_POST['webtolead_email1']) && $_POST['webtolead_email1'] != null)
                {
                    $lead->email1 = $_POST['webtolead_email1'];
                }