TOPIC:

help with custom email template 1 year 1 month ago #236503

  • Topic Author
  • dama
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 46
  • Thanks: 1
Hi

I'm using custom email template and for mailback.html.php file I want it to start like this:
Dear (name and surname),
Thank you for contacting us...

Name of the element is "name".

What code I need to use to display the value of element "name"?

Below this I have standard code:
<?php foreach ($MAILDATA as $DATA): ?>
<?php echo $DATA[_FF_DATA_TITLE]?>: <?php echo $DATA[_FF_DATA_VALUE]?><?php echo $NL ?>
<?php endforeach; ?> 

Regards

Please Log in or Create an account to join the conversation.

help with custom email template 1 year 1 month ago #236507

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
Hello,

Please try using the following code:
<?php foreach ($MAILDATA as $DATA): ?>
<?php if($DATA[_FF_DATA_NAME] == "name") { 
	echo "Dear ". $DATA[_FF_DATA_VALUE] . $NL; }
	echo "Thank you for contacting us..";
?>

<?php else { echo $DATA[_FF_DATA_TITLE]?>: <?php echo $DATA[_FF_DATA_VALUE]?><?php echo $NL }?>
<?php endforeach; ?>

Let me know whether this is working how you wanted.

Regards,

Mihaela

Please Log in or Create an account to join the conversation.

help with custom email template 1 year 1 month ago #236512

  • Topic Author
  • dama
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 46
  • Thanks: 1
HI Mihaela and thanks for trying to help but this code is not working.

When I apply it and hit Send button I get small popup up window saying "Error" and after that only admin receives the email. Nothing is sent to user/client.

If I remove the code there is no error message and they receive the email.

I also tried removing the quotes in second line from

<?php if($DATA[_FF_DATA_NAME] == "name")

to

<?php if($DATA[_FF_DATA_NAME] == name)

because that is the actual name of element but with no luck.

Any ideas why is this happening?

Please Log in or Create an account to join the conversation.

Last edit: Post by dama.

help with custom email template 1 year 1 month ago #236530

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
You are right,

The code I've sent you has an error.

Please use this code instead if "name" element is the first element in your form:
<?php foreach ($MAILDATA as $DATA): ?>
<?php if($DATA[_FF_DATA_NAME] == "name"): ?>
		<?php echo "Dear ". $DATA[_FF_DATA_VALUE] . $NL . "Thank you for contacting us..." . $NL; ?>
<?php else: ?>
	<?php echo $DATA[_FF_DATA_TITLE]?>: <?php echo $DATA[_FF_DATA_VALUE]?><?php echo $NL; ?>
<?php endif; ?>
<?php endforeach; ?>

If "name" element isn't the first one, use this code:
<?php foreach ($MAILDATA as $DATA): ?>
<?php if($DATA[_FF_DATA_NAME] == "name"): ?>
		<?php echo "Dear ". $DATA[_FF_DATA_VALUE] . $NL . "Thank you for contacting us..." . $NL; ?>
<?php endif; ?>
<?php endforeach; ?>

<?php foreach ($MAILDATA as $DATA): ?>
<?php echo $DATA[_FF_DATA_TITLE]?>: <?php echo $DATA[_FF_DATA_VALUE]?><?php echo $NL ?>
<?php endforeach; ?>

Let me know whether this is working properly for you.

Regards,

Mihaela

Please Log in or Create an account to join the conversation.

help with custom email template 1 year 1 month ago #236542

  • Topic Author
  • dama
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 46
  • Thanks: 1
Hi

now it is working but I need one more modification. Currently text in email looks like this:
Dear test, Thank you for contacting us...

But I want it look it like this:
Dear test,
Thank you for contacting us...

What do I need to add to display second part in new line?

Please Log in or Create an account to join the conversation.

help with custom email template 1 year 1 month ago #236594

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
Hello again,

That is strange because it should display a break because of $NL. I've tested the code and in the email, I did get this look:
Dear test,
Thank you for contacting us...

Can you please send me your template file to see why the break isn't displayed for you?

Also, you can try once again with this code:
<?php foreach ($MAILDATA as $DATA): ?>
<?php if($DATA[_FF_DATA_NAME] == "name"): ?>
		<?php echo "Dear ". $DATA[_FF_DATA_VALUE] .",". $NL . $NL . "Thank you for contacting us..." . $NL; ?>
<?php endif; ?>
<?php endforeach; ?>

<?php foreach ($MAILDATA as $DATA): ?>
<?php echo $DATA[_FF_DATA_TITLE]?>: <?php echo $DATA[_FF_DATA_VALUE]?><?php echo $NL ?>
<?php endforeach; ?>
and see whether that achieves the email look that you wanted.

Regards,

Mihaela

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.051 seconds

Summer Sale!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!