Mailback custom HTML and Subject - MultiLanguge

  • baggio
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 0

baggio replied the topic: Mailback custom HTML and Subject - MultiLanguge

Dear Mihaela,

with your new code, now the user receives the english email.
Nevertheless, there are still some aspects to fix:

1) when I submit from the EN-GB frontend, the user receive both the EN-GB Custom Email and the IT-it Custom Email version.

2) the line <p>Dear {Nome:value},</p> is not working. In the email I see "Dear {Nome:value}", not the name of the user. By the way at the end of the email, 3 values are reported in lines. I guess that depend upon this code you added:

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

So, how can I change this code in order to show up <p>Dear {Nome:value},</p> exactly where it is?

3) I need to change the EMAIL SUBJECT for each language(en,fr,de). Can you add sample code please as you have done for the body1, body2, body3?

4) Image in the HTML is not showing. I don't receive it also in the italian default language. The image is showing properly in the editor. Is it a problem of relative path or because it is an svg?

thanks
#232050
  • Posts: 1437
  • Karma: 48
  • Thank you received: 188

mihaela replied the topic: Mailback custom HTML and Subject - MultiLanguge

Hello again,

I'm glad that now the user receives the English email.

1) I assume why this is happening. Please go to Advanced properties of "email" field in your form. If "Mailback" is checked, uncheck it. With that checkbox you determine whether the custom Mailback email will be sent to the user.

2) You can't fetch values submitted in the form using this {Nome:value}. Instead, you should fetch all the wanted values with ff_getSubmit('fieldname') function.
In your case it would look like this:
$body1 = '<html><body>
<p>Dear '. ff_getSubmit("Nome") . ',</p>
I didn't adjust the code completely, I've just sent you an example for html. Be careful to be consistent with the quotes signs that you are using.

Furthermore, you wrote "By the way at the end of the email, 3 values are reported in lines. I guess that depend upon this code you added...". Yes, this will report all form values inline with their labels. You can adjust that if you want.

3) Here is the example for setting different EMAIL SUBJECT for each language(en,fr,de)
You have to adjust the last part of code with this piece of code:
if ($lang_tag == 'en-GB') {
$isHtml = true;
$subject = "English subject";
$this->sendMail($from, $fromname, $recipient, $subject, $body1, $attachment, $isHtml); 
}
if ($lang_tag == 'de-DE') {
$subject = "German subject";
$this->sendMail($from, $fromname, $recipient, $subject, $body2, $mode=1, $attachment);
}
if ($lang_tag == 'fr-FR') {
$subject = "French subject";
$this->sendMail($from, $fromname, $recipient, $subject, $body3, $mode=1, $attachment);
}
NOTE: You can delete this line of code:
$subject = 'Your Email Subject'; // Change to your preferred Email subject
from the previous piece of code.

5) I'm not sure what is causing the picture not to display. Please try using the absolute path.

Regards,

Mihaela
#232054
  • baggio
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 0

baggio replied the topic: Mailback custom HTML and Subject - MultiLanguge

Dear Mihaela,

I think we are close but remaining issues:

1) Now that I unchecked the "mailback" I receive the mailback only for the english version, but not for the default language (italian).
Should I manage also the default language inside the code you provided? Not anymore in the editor?

2) Please have a look at the code on line 8:
$subject = 'Your Email Subject'; // Change to your preferred Email subject
// you can define here $sumject1, $subject2 and $subject3 to have different subject for // each language

After the last customization you made on the subject, look at the last block of code, do I still need to keep the above code?

Could you have please a look at the final code below? If ti is correct,

Thanks


*************CODE**************

$this->execPieceByName('ff_InitLib');
$lang = JFactory::getLanguage();
$lang_tag = $lang->getTag();
$from = 'Email@OfYourSite.com'; //Change to the sites Email address
$fromname = 'YourSitesName'; //Change to your Sites name
$subject = 'Your Email Subject'; // Change to your preferred Email subject
// you can define here $sumject1, $subject2 and $subject3 to have different subject for // each language

$recipient = ff_getSubmit('email');

$body1 = '<html><body>
<p>Dear '. ff_getSubmit("Nome") . ',</p>
<p>Thanks for contacting me.</p>
<p>I will reply to your message in the next 48 hours, </p>
<p>Best Regards,</p>
<p><img src="images/logo-color.svg" /></p>
<p>*********************************</p>
<p>Your message: '. ff_getSubmit("Messaggio") . '</p>
';

$body2 = 'German Version';
$body3 = 'French Version';


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





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

if ($lang_tag == 'en-GB') {
$isHtml = true;
$subject = "English subject";
$this->sendMail($from, $fromname, $recipient, $subject, $body1, $attachment, $isHtml);
}
if ($lang_tag == 'de-DE') {
$subject = "German subject";
$this->sendMail($from, $fromname, $recipient, $subject, $body2, $mode=1, $attachment);
}
if ($lang_tag == 'fr-FR') {
$subject = "French subject";
$this->sendMail($from, $fromname, $recipient, $subject, $body3, $mode=1, $attachment);
}
#232059
  • Posts: 1437
  • Karma: 48
  • Thank you received: 188

mihaela replied the topic: Mailback custom HTML and Subject - MultiLanguge

Ok,

We are getting closer for it to work as you want.

1) Yes, you should manage also the default language inside the code you provided. You have to define body of that email as $body4 for example. Put there the wanted context and add code similar to this:
if ($lang_tag == 'it-IT') {
$isHtml = true;
$subject = "Italian subject";
$this->sendMail($from, $fromname, $recipient, $subject, $body4, $attachment, $isHtml);
}

2) You wrote "After the last customization you made on the subject, look at the last block of code, do I still need to keep the above code?". The answer is no, as I've written in the previous post, after setting subject for each language you don't need that code anymore (even though keeping it wouldn't make a difference).

From what I can see, your code looks fine now.
You just have to add the case for Italian language.

Regards,

Mihaela
#232061
  • baggio
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 0

baggio replied the topic: Mailback custom HTML and Subject - MultiLanguge

Ok mihaela.
Still an issue.
On the english frontend page, the original page title is not showing anymore.
The form title was overwriting the page title, so I empty it, but now I have the URL.

If I unpublish your module , the original page title comes back, so it is your module that affect it.

his happen only for the english version, and not for the italian defalut language.
How to fix it?

Furthermore I'm wondering now what happen if in another form I want to add the mailback subject as a value that the subject submitted in the field "subject". How to get it?


Best,
#232069
  • Posts: 1437
  • Karma: 48
  • Thank you received: 188

mihaela replied the topic: Mailback custom HTML and Subject - MultiLanguge

Hello again,

It is strange the problem you addressed happens only for the English version, and not for the Italian default language.
So you are publishing the form through module? On which position did you put the module? Please try changing the module's position.

Here is how you can set the value entered in subject field as mailback email subject for the other form.
You have to put {subject} in Custom Email Subject field in form's Advanced properties > More options > Mailback Emails. So, the syntax is to put
{fieldname}
and the value entered in that field in form will appear as subject.

Let me know whether this works as wanted.

Regards,

Mihaela
#232099
Moderators: ForumSupporttomeperica
Time to create page: 0.071 seconds

New Support System

Dear Customers,

Users with active subscription have support priority which will be dona via ServiceDesk (My Account > Raise a ticket).
FREE Support topics will be answered when AND if there is time.

You can check support guidelines here : here

Regards,
Crosstec 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

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€

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!

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