TOPIC:

Mailback custom HTML and Subject - MultiLanguge 1 year 11 months ago #233646

  • maikla73
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 13
  • Thanks: 0
Hello,

I was very happy to found here a solution for customized emails in different languages.
I use the code below and it works fine.
The only problem I have is that the [_FF_DATA_TITLE] is coming in the email only in German language.
And the image is not shown in the email.

Any idea how I can fix this?
Another question is can I modify the content that the labels and values are in a table?
$this->execPieceByName('ff_InitLib');
$lang = JFactory::getLanguage();
$lang_tag = $lang->getTag();
$from = 'info@test.com'; 
$fromname = 'TEST'; 

$recipient = ff_getSubmit('email');

$body1 = '<html><body>
<p><img src="images/content/Logo.png" /></p>
<p>Thank you very much for your interest.</p>
<p>If you have more questions dont hesitate to contact us.</p>
<p>Just reply to this email.</p>
<p>_____________________________________________________________________________</p>
';

//Add form values to the custom email content
foreach ($this->maildata as $data) {
$body1 .= '<br>' . $data[_FF_DATA_TITLE].': '.$data[_FF_DATA_VALUE]. '<br>';
}

$body1 .='</body></html>';

$body2 = '<html><body>
<p><img src="images/content/Logo.png" /></p>
<p>Vielen Dank für das Interesse an.</p>
<p>Sollten Sie weitere Fragen haben zögern Sie nicht uns anzusprechen.</p>
<p>Antworten Sie einfach auf diese Email.</p>
<p>_____________________________________________________________________________</p>
';

//Add form values to the custom email content
foreach ($this->maildata as $data) {
$body2 .= '<br>' . $data[_FF_DATA_TITLE].': '.$data[_FF_DATA_VALUE]. '<br>';
}

$body2 .='</body></html>';

if ($lang_tag == 'en-GB') {
$isHtml = true;
$subject = "English";
$this->sendMail($from, $fromname, $recipient, $subject, $body1, $attachment, $isHtml);
}
if ($lang_tag == 'de-DE') {
$isHtml = true;
$subject = "German";
$this->sendMail($from, $fromname, $recipient, $subject, $body2, $attachment, $isHtml);
}

Thank you in advance and KR
Maik

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

Mailback custom HTML and Subject - MultiLanguge 1 year 11 months ago #233649

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

I'm glad that you've found the functionality you needed.

You wrote "The only problem I have is that the [_FF_DATA_TITLE] is coming in the email only in German language." . I am not sure whether this can be solved without quite a bit of additional coding, but please try to use $data[_FF_DATA_NAME] instead of $data[_FF_DATA_TITLE] and see what happens.

As for the image which is not shown, please try to put the absolute path as image "src" instead of putting relative path.

To display data submitted in the form in a table, try to replace this piece of code:
foreach ($this->maildata as $data) {
$body1 .= '<br>' . $data[_FF_DATA_TITLE].': '.$data[_FF_DATA_VALUE]. '<br>';
}

with the following one:
$body1 .= '<table width="100%" border="1" cellpadding="5">';
foreach ($this->maildata as $data) {
	$body1 .= '<tr><td>' .  $data[_FF_DATA_TITLE] .'</td><td>' . $DATA[_FF_DATA_VALUE] . '</td></tr>';
}
$body1 .= '</table>';

Let me know whether this helped and whether you've managed to set it to work for your form.

Regards,

Mihaela

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

Mailback custom HTML and Subject - MultiLanguge 1 year 11 months ago #233650

  • maikla73
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 13
  • Thanks: 0
Hi Mihaela,

thank you for quick reply.
The [_FF_DATA_NAME] doesn't work, I still get only German titles.
The table and image are fine now.

Is it possible to create a table manually that I can define by myself which data are in the email and which not?

Then I can set German and English labels manually.

Thank you and KR
Maik

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

Mailback custom HTML and Subject - MultiLanguge 1 year 11 months ago #233676

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

Yes, it is possible to create a table manually, in a way that you put there elements and titles that you want.

That was what I planned to suggest if your form is not too lengthy.

There are two ways that you can grab the values submitted in the form.
First way is to get values like this:
$adresse= ff_getSubmit('adresse');

For example, for English version you could then use this code:
$adresse= ff_getSubmit('adresse');
$body1 .= '<table width="100%" border="1" cellpadding="5">';
	$body1 .= '<tr><td>Address: </td><td>' . $adresse . '</td></tr>';

$body1 .= '</table>';

This is just an example for one field named "adresse" in German form. You would add here as many table rows as needed.

The other solution is to add if condition for EACH FORM FIELD in foreach loop. Here is an example for name:
$body1 .= '<table width="100%" border="1" cellpadding="5">';
foreach ($this->maildata as $data) {
    if( $data[_FF_DATA_TITLE] == "adresse") {
	    $body1 .= '<tr><td>Address: </td><td>' . $DATA[_FF_DATA_VALUE] . '</td></tr>';
	}
}
$body1 .= '</table>';
NOTE: This example will avoid empty lines in case some form element isn't filled in.

Let me know whether you've managed to set this to work as you wanted.

Regards,

Mihaela

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

Mailback custom HTML and Subject - MultiLanguge 1 year 11 months ago #233698

  • maikla73
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 13
  • Thanks: 0
Hello Mihaela,

thank you very much, it works perfectly.

Just some short questions.
Is it possible to add a link to the image?
Is it posibble to add a mailto link for text?
And ist is possible to modify font size and colour?

Thank you very much for support and KR
Maik

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

Mailback custom HTML and Subject - MultiLanguge 1 year 11 months ago #233701

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

I'm glad that it is working.

Here are the answers to your other questions.

1. Yes, it is possible to add a link to the image:
Here is an example how you can do so:
<a href="https://www.google.com/">
<img border="0" alt="Smiley" src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/SNice.svg/220px-SNice.svg.png" width="100" height="100">
</a>
NOTE: replace " www.google.com/ " with the address you wish to link, and " upload.wikimedia.org/wikipedia/commons/t.../220px-SNice.svg.png " with the image that you wish to be displayed.

If what you wanted to know is how to have a link pointing to an image, you can do it the following way:
<a href="https://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/SNice.svg/220px-SNice.svg.png">Image link</a>

2. You wrote "Is it possible to add a mailto link for text?". I'm not sure what you want to achieve, can you please explain a bit more?

3. It is possible to modify font-size and color. You should simply add css code for that. For example, like this:
<p style="font-size:20px; color:blue;">

Let me know whether you've managed to set this for your form (email).

Regards,

Mihaela

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

Moderators: ForumSupport
Time to create page: 0.049 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

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!