The PDF in attachment is working correct but:

1. The mail arrives always in SPAM-folder
2. The mail subject and body is empty (admin/commerce/config/billy-invoice/billy-mail -> is filled in correctly)

I've tried to use a SMTP-server to avoid the spam problem, this works perfectly with system mails but when I send the invoice I get error 'The invoice cannot be sent'.

Could you help me with those issues?

Comments

stebentje created an issue. See original summary.

diriy’s picture

Priority: Normal » Major
StatusFileSize
new42.99 KB
new28.11 KB
new18.63 KB
new26.29 KB
new6.37 KB

I have this issue also. Except a spam folder.
I have also clear body and mail subject but with attachments. But the attachment tpl is possible only if I use the overriden template which I had to create in my theme's folder. And it can't print line items or any other variables at all. I attach some screens. How can I fix it?

grougy’s picture

Is Variable enabled/installed on your site ?
If so please try to set the variable in admin/config/regional/i18n/variable
- Commerce Billy Mail Subject
- Commerce Billy Mail Body
If Variable module is enabled the $body and $subject will come from Variable module, even if not set...
Looks like a bug, the module should check if the variable is set, not only if Variable module is enabled ?

current code in _commerce_billy_mail_send_order_invoice function :

    if (module_exists('i18n_variable')) {
// If i18n_variable module is used:
// Get the text variables directly and not from the cache, because the language might not match the current $language here.
      $subject = i18n_variable_get('commerce_billy_mail_subject', $language->language, '');
      $body = i18n_variable_get('commerce_billy_mail_body', $language->language, ''); //body text in HTML format
    }
    else {
// Default variable get.
      $subject = variable_get('commerce_billy_mail_subject', '');
      $body = variable_get('commerce_billy_mail_body', ''); //body text in HTML format
    }
diriy’s picture

the Variable module is properly installed.
I solved this problem by customisation of the template, but I donæt think that it is a proper work of the module, so that's a bug and need to be fixed, I supposed.

grougy’s picture

The module should do something like this :

$body  = is_null(i18n_variable_get('commerce_billy_mail_body', $language->language, '')) ? variable_get('commerce_billy_mail_body', '') : i18n_variable_get('commerce_billy_mail_body', $language->language, '');

  • Anybody committed 26404ef on 7.x-1.x
    Issue #2611120 by diriy, grougy, stebentje: Empty mail - attachment is...
anybody’s picture

Status: Active » Fixed

Please try with the latest .dev release just released. I fixed it there like described. Please provide final feedback.

diriy’s picture

works fine! thank you!

diriy’s picture

Status: Fixed » Closed (fixed)
jawi’s picture

With latest dev version the issue still occurs.

anybody’s picture

Mhm... any Ideas for reasons? I'm having no clue...

candelas’s picture

I was having the same problem. I didn't know that I had to enable the variables translation since I got the string translated in admin/config/regional/translate/translate. After reading this thread, I went to the i18n_variable configuration and enabled Commerce Billy Mail Subject and Commerce Billy Mail Body. Then I went to the Commerce Billy Mail configuration admin/commerce/config/billy-invoice/billy-mail and translate the 2 variables. After that it worked. I think that it would be a good idea to add this in the README.txt since people we can mistake. Thanks very much for the module :)

gmrmedia’s picture

@candelas your solution work! :)

Module show error that some string is empty, but it dosent report, that there is no tralslations for subject & body strings ;)

jose.devega’s picture

Hi guys

There are an issue on beta7:

if (module_exists('i18n_variable')) {
// If i18n_variable module is used:
// Get the text variables directly and not from the cache, because the language might not match the current $language here.
$subject = i18n_variable_get('commerce_billy_mail_subject', $language->language, '');
// i18n_variable_get returns nothing if the realm is not set -.-
if (is_null($subject)) {

In case i18n_variable module is enabled and realm for commerce_billy_mail_subject (or commerce_billy_mail_body) is not set, is_null($subject) is not true, so never gets the value of variable.

Solution is calling i18n_variable_get with null instead of '' as default value

Patch added

anybody’s picture

Version: 7.x-1.0-beta5 » 7.x-1.x-dev

@jose.devega thank you very much, you are right!
I just corrected this in the latest dev branch. Please test if it's alright now.

jose.devega’s picture

Welcome, thanks to you!!!

klausi’s picture

We just ran into the same bug because we use the latest stable release. The fix was never released.

@Anybody can you make a new release so that people do not run into the same bug again?

anybody’s picture

Hi @klasi,

sorry! Of course. I just created 7.x-1.0-beta8, please have a try, if everything works fine... some days passed since that commit. ;)