🇳🇱Netherlands @myDrupal2014_846824658246

Account created on 4 June 2014, about 10 years ago
#

Recent comments

🇳🇱Netherlands myDrupal2014_846824658246

Thxs, I followed the steps you gave and some other things and now it is working !
Thxs again !

🇳🇱Netherlands myDrupal2014_846824658246

Thxs, I found my mistake. I had configurated that i always use admin everywhere. Your module is working great ! Thxs !

🇳🇱Netherlands myDrupal2014_846824658246

Thanks, i looked into it and this was indeed the case.

I solved it by installing https://www.drupal.org/project/bootstrap_library by composer

Then filled in the setting:
use CDN
use composer installed libs
for the themes you want
all pages
css and js files

And in the custom module the code:

if (\Drupal::moduleHandler()->moduleExists('bootstrap_library')) {
$library = theme_get_setting('bootstrap_barrio_library');
switch ($library) {
case 'cdn' :
$variables['#attached']['library'][] = 'bootstrap_library/bootstrap-cdn';
break;
case 'production':
$variables['#attached']['library'][] = 'bootstrap_library/bootstrap';
break;
case 'development':
$variables['#attached']['library'][] = 'bootstrap_library/bootstrap-dev';
break;
}
}

thxs all

🇳🇱Netherlands myDrupal2014_846824658246

Message is also coming when increasing the memory to 5G;

Fatal error: Allowed memory size of 5368709120 bytes exhausted (tried to allocate 3219132416 bytes) in /var/www/html/office/docroot/modules/contrib/disable_messages/disable_messages.module on line 220

I did not apply the patch which is mention in the main thread.

🇳🇱Netherlands myDrupal2014_846824658246

The content of the noname file of 1 kb is.

This is a multi-part message in MIME format...

----

🇳🇱Netherlands myDrupal2014_846824658246

Hi,

I created a test case.

a) I send an email without attachments. The email is recieved perfectly in gmail.

b) I add two files to the mail. I dubbelchecked and the output array is 100% matched with the code.

Here is the source code:

public function get_files_attached_from_email($emailid){

// Based on example code on https://www.drupal.org/project/email_attachment
$node = \Drupal::entityTypeManager()->getStorage('node')->load($emailid);
$files_nids = array();

// Get the content of the file field of the content type
foreach ($node->field_attach_file as $reference) {
if ($reference->target_id != NULL){
$files_nids[] = $reference->target_id;
}
}

/*
$params = ['attachments' => [
[
'filecontent' => 'Your attachment contents. You could use file_get_contents() instead of this string.',
'filename' => 'attached_filename_how_recipients_see_it.txt',
'filemime' => 'text/plain',
],
[
'filecontent' => file_get_contents('temporary://test.pdf'),
'filename' => 'Invoice.pdf',
'filemime' => 'application/pdf',
],
],
// further params as needed by your hook_mail
];*/

$filelist = array();
foreach ($files_nids as $id) {

// Load the file node
// dump($id);
$node = \Drupal::entityTypeManager()->getStorage('node')->load($id);
//dump($node);

foreach ($node->field_file as $reference) {
dump($reference);
$fileid = $reference->target_id;

// Get each file within the file node fileds
$f = \Drupal::entityTypeManager()->getStorage('file')->load($fileid);

$file = array();
$file['filecontent'] = file_get_contents(\Drupal::service('file_system')->realpath($f->getFileUri()));
$file['filename'] = $f->getFilename();
$file['filemime'] = $f->getMimeType();
$filelist[] = $file;

// dump($filelist);
//dump($file);
}
}

Which is send by code including a hook_mail who does nothing with the param array

$node = Node::load($emailid);
$node->field_send->value = FALSE;
$node->field_date_last_send->value = $now->format('Y-m-d\TH:i:s');
$node->save();

// https://www.valuebound.com/resources/blog/how-to-send-mail-programmatica...
// https://webazzle.com/knowledge-base/sending-e-mail-drupal-8
// Set all parameters for the mail
$mailManager = \Drupal::service('plugin.manager.mail');
$module = xxxx
$key =xxxx
$to = $node->field_to->getString();
$params['from'] = xxxxxxx
$params['message'] = $node->get('body')->value;
$params['subject'] = $node->title->value;
$params['attachments'] = $this->get_files_attached_from_email($emailid);

$langcode = \Drupal::currentUser()->getPreferredLangcode();
$send = True;

// Set content-type header for sending HTML email
$headers = "From: " . strip_tags($params['from']) . "\r\n";
$headers .= "Reply-To: ". strip_tags($params['from']) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

// Send the mail
$result = $mailManager->mail($module, $key, $to, $langcode, $params, $params['from'], $send);

Which specific suggestion can you do instead of a generic idea?
Can you exclude the noname attachement by code in your module?

Thanks !

🇳🇱Netherlands myDrupal2014_846824658246

Yes I can but I applied

https://www.drupal.org/project/smtp/issues/3190663#comment-14330548 💬 Missing PHPMailer is Required for SMTP to function Fixed

and then it worked like a charm.

So based on that there is no issue with the related configuration...

🇳🇱Netherlands myDrupal2014_846824658246

Currently this can be done with adding a html element into the form.

🇳🇱Netherlands myDrupal2014_846824658246

Clicking on the link gives a 404 error on page:

admin/config/media/blazy

Pls advice.

🇳🇱Netherlands myDrupal2014_846824658246

I did run the update now with sudo rights and I'm getting the following errors:

Preparing a backup snapshot before performing updates...
[success] Database dump saved to /var/www/html/office/update_backups/db.sql
git version 2.34.1
Preparing composer.json for Varbase updates...
/var/www/html/office/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 123: composer: command not found
/var/www/html/office/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 149: composer: command not found
/var/www/html/office/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 260: composer: command not found
There was an error while preparing composer.json for Varbase updates. Please check /var/www/html/office/.update-error-log for more information.
If you are running Varbase 8.x-4.x or 8.x-5.x version, make sure to update varbase-project using the update command:
composer require vardot/varbase-updater
Would you like to abort the update process and restore the backup? (no):

mv: cannot stat '/var/www/html/office/composer.new.json': No such file or directory
composer.json has been updated. Now is your chance to perform any manual changes. Please do your changes (if any) then press enter to continue...

Updating Varbase...
/var/www/html/office/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 276: composer: command not found
There was an error while updating Varbase to the latest version. Please check /var/www/html/office/.update-error-log for more information.
Would you like to abort the update process and restore the backup? (no):

[success] Cache rebuild complete.
Enabling new required modules for the latest Varbase version...
Updating the database for latest changes.
[success] Cache rebuild complete.
[success] No pending updates.
Hoya! Updates are now done. We will add a link in the near future for here to link to common issues appearing after updates and how to fix them.
/var/www/html/office/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 319: composer: command not found
marcel@MSI:/var/www/html/office$

The error log (some errors game with previous attempts for installation)

^[[37;42;1m[success]^[[39;49;22m Database dump saved to /var/www/html/office/update_backups/db.sql
^[[32mPreparing composer.json for Varbase updates...^[(B^[[0m
^[[32mUpdating Varbase...^[(B^[[0m
/var/www/html/office/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 276: composer: command not found
^[[37;42;1m[success]^[[39;49;22m Cache rebuild complete.
^[[32mEnabling new required modules for the latest Varbase version...^[(B^[[0m
^[[32mUpdating the database for latest changes.^[(B^[[0m
^[[37;42;1m[success]^[[39;49;22m No pending updates.
^[[32mHoya! Updates are now done. We will add a link in the near future for here to link to common issues appearing after updates and how to fix them.^[(B^[[0m

Installation is now at :
Varbase (varbase-9.0.16)

🇳🇱Netherlands myDrupal2014_846824658246

Only updating varbase_email 906 to 911 or
update varbase : You are on vardot/varbase (9.0.16). A newer version (9.0.3) is now available?

🇳🇱Netherlands myDrupal2014_846824658246

Thxs, i spend some time to find :

Navigate to Administration \ Configuration \ System \ Mailer

but I do not have that.
I checked permissions but I'm super admin
Also If I enable the Drupal Swift Mailer module nothing is changed.

I found other paths but none of them is displaying the screen : Mailer Policy like mentioned in the documentation..
Any suggestion what should be done?

🇳🇱Netherlands myDrupal2014_846824658246

Settings are:
OS is Win64b

I using wamp server 64 defaults. Default Php mem limit is 128M, max execution time is 120

Changed this to php mem limit = 768m and max exection time is 240

Did run a test again. Using dos/cli with admin rights.
Same error

Git is available in the path
path is not

Installed cygwin for windows
installed patch withing cygwin and made sure it is in the windows path

Did run the installer again. Pathes are now applied.

Thxs for support. I will close the issue

🇳🇱Netherlands myDrupal2014_846824658246

I use php 8.1.13
Composer version 2.6.4 2023-09-29 10:54:46

Production build 0.69.0 2024