help with custom email template

  • dama
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 45
  • Thank you received: 1

dama created the topic: help with custom email template

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
#236503
  • Posts: 2461
  • Karma: 86
  • Thank you received: 333

mihaela replied the topic: help with custom email template

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
#236507
  • dama
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 45
  • Thank you received: 1

dama replied the topic: help with custom email template

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?
#236512
  • Posts: 2461
  • Karma: 86
  • Thank you received: 333

mihaela replied the topic: help with custom email template

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
#236530
  • dama
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 45
  • Thank you received: 1

dama replied the topic: help with custom email template

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?
#236542
  • Posts: 2461
  • Karma: 86
  • Thank you received: 333

mihaela replied the topic: help with custom email template

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
#236594
Moderators: ForumSupporttomeperica
Time to create page: 0.068 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

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!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here