Problem with "Email" field in the email templates for WebToPerson forms

On my website, I use WebToPerson form with the Lead workflow.
The form includes an “Email” field and in the email template I have tried all of the below variations for the correct variable for this field:

$webtolead_email1
$_REQUEST
$email1
$bean->email1
$lead_webtolead_email1
$lead_email
$lead_email1
$emailaddress_email_address
$lead_email_addresses_non_primary
$lead_webtolead_email2

Unfortunately, none of them work:
The “Email” field in the notification email I receive after the visitor has submitted the form is either empty, or just copies the variable name.

I’d appreciate any help in the matter. Does anybody have an idea on what is the correct variable name for the “Email” field?
I am using Version 7.11.3
Sugar Version 6.5.25 (Build 344)

What is the field’s name in the HTML of your web-to-person form? Use your browser’s developer tools to check this.

Then check if the field is correctly saved in the record, in SuiteCRM. Does it show in the detail view, correctly?

If so, then you don’t have a problem with the web-to-person form, you just have a problem with the Email template. Maybe this one: https://github.com/salesagility/SuiteCRM/issues/6535

Thank you for the advice. The HTML form was generated by using the “create webtoperson form” command.
The field name in the HTML form reads “email1” and it does save correctly in the SuitCRM record. So there is definitely a problem with the email template used for the email notification.
The solution described in your linked thread didn’t help me much because this is the only field which is not working correctly in my email template, and all other fields are we working absolutely fine: I do receive their data in the notification email.
I hope that in the email template I am just using an incorrect variable name available from the list of variables in the template builder, so maybe somebody could just point me to the some undocumented one, which would work correctly.

I just tried with

$lead_email1

and the email sent fine, and replaced the value correctly. I had to make sure that my Email was linked to a Lead record, and that this Lead record had an email. I did not start from the web-to-person form, I just used the Compose window.

Thanks a lot for the input. Following your advise I tried to use the Compose window, but have received an error: “Error Sending Email. Please contact your administrator for assistance.”
Just doing that, I’ve noticed that the “From” dropdown field in the Compose window is empty and there are now records in the dropdown to choose from. Any idea?

You need to check your email set up.

Admin / Outbound email
or
User profile / Email

Hi pgr,

Thanks a lot for your help and effort. I’ve fixed the problem with the “From” field, so now it picks up the main email account.
However, still I get the same error while trying to send a test email message from the Compose window: “Error Sending Email. Please contact your administrator for assistance.”
Do you have any idea on what else can be wrong?

You should have more information in one of your logs

Hi, PGR,

Thanks a lot for your help. I’ve checked the suitecrm.log and have found many errors like this:
“Sun Apr 28 00:08:17 2019 [7227][1][FATAL] SugarPHPMailer encountered an error: SMTP Error: The following recipients failed: test@test.test: Requested action not taken: mailbox unavailable
invalid DNS MX or A/AAAA resource record”

I did not try to send any emails to test@test.test. In fact, I did send to one of my valid mailboxes. Do you have any idea why the mailer is trying to send to the orphan invalid mailbox?

If you uncomment this line:

https://github.com/salesagility/SuiteCRM/blob/master/include/SugarPHPMailer.php#L457

you will see more information in your logs (st them to DEBUG level in Admin/System settings).

And also here

https://github.com/salesagility/SuiteCRM/blob/master/include/SugarPHPMailer.php#L497-L502

if you un-comment that, you will get a full SMTP log in suitecrm.log. You can see what the email server is complaining about.

Thank you, PGR!

I’ve checked the extended log and was able to fix the SMTP problem!

Now, if I send an email from the Compose window using a template with the “lead_email1” variable in it, everything works absolutely fine, and I receive the correctly loaded “Email” field in the email notification.
However, when the same template is used in the WebToPerson form worklflow, then the email is sent out sme way as it was before, but the “Email” field still comes empty. Any idea?

Best,

What does the “WebToPerson form worklflow” look like?

Is it running on a Lead record?

Yes, it is a simple workflow, which is supposed to send two emails when the new lead is submitting this form: https://surenet.io/partners/.
The “thank you” email goes to submitter, and this one works absolutely fine. The other email is sent to my address with the lead’s info — this is the one I havea problem with: I receive all info from the form, but the “Email” field, which comes empty.
In the workflow, I use the same email template I used in the Compose window, but with the different results: from the Compose I perfectly receive all fields, but from the workflow the “Email” filed comes empty.

I have a Workflow doing exactly this and it works normally. Maybe you need to share the full details of your WF and your Template so we can try and figure out any small detail that might be breaking it…

Hi PGR,

Thank you for your involvement! I’ve added new admin level user to https://crm.itechfusion.com:
pgr/pgr1!

The workflow name I’ve just tested is “SureNET Partner Request”. It is using an email template named “New Partner Request” and works with this form on my website: https://surenet.io/web-form-partner/

I also have exactly the same problem with another workflow named “SureNET Pilot Request”, which is working with this form: https://surenet.io/web-form-pilot/ using an email template named “New Pilot Request”.

That login doesn’t work…

I’ve just checked it:
https://crm.itechfusion.com
Login: pgr
Password: pgr1!
and it worked fine for me.
What error do you get?

“login expired”. Happens every time, and immediately, I never get to see the home screen.

Maybe it’s some problem due to the fact that I am accessing it from the outside network?

I’m traveling and accessing it from my phone’s LTE, but I’m on my Chrome, so I will try to reproduce that error on my friend’s iPhone’s Safari

Worked fine from my friend’s iPad on public WiFi. Could you please try in the incognito mode?