How can I install phpmailer library for the phpmailer_smtp module on D885 on a shared server without ssh and without composer? Installing composer on this seems impossible or very convoluted.

Putting it in sites/all/libraries/PHPMailer and library/PHPMailer and phpmailer/phpmailer (and six other combinations) didn't work.

Just_SMTP works without composer by putting library/PHPMailer. It was simple and easy. Can it be that simple for phpmailer_smtp?

CommentFileSizeAuthor
#9 add_ludwig_support-3133980-9.patch321 bytesimclean

Comments

sajosh created an issue. See original summary.

sajosh’s picture

Title: How to install phpmailer_smtp without composer? » How to install phpmailer library without composer?
imclean’s picture

Status: Active » Closed (works as designed)

Hi @sajosh, thanks for your interest.

Composer is a very efficient tool for including external libraries and managing dependencies. As it is now the standard for Drupal, there are no plans to support other installation methods for this module.

You can try to hack something together yourself but it would be convoluted and hard to maintain.

Best practice would be to install composer on a local development environment, build the site locally then upload it to your shared hosting hosting platform.

mmjvb’s picture

The best practice is to use Ludwig for situations not supporting Composer. That would require a ludwig.json specifying the requirements. You can produce one based on composer. Maybe there are alternatives to this module that are prepared to support it.

imclean’s picture

Title: How to install phpmailer library without composer? » Look into supporting Ludwig to download PHPMailer library
Version: 8.x-1.4 » 8.x-1.x-dev
Category: Support request » Feature request
Status: Closed (works as designed) » Active

Ludwig is an alternative. Useful, but not necessarily "best practice". I can look into it, however.

Maybe there are alternatives to this module that are prepared to support it.

Maybe there are, nobody's forced to use any specific module. The aim here is to have a very lean, single focus module with some advanced config options.

I don't use Ludwig but I'm willing to accept a patch. If one isn't forthcoming I'll have a go at creating a ludwig.json but I'll need to understand its limitations.

Does it require an exact version of the library? Do I need to create a "libraries" sub folder? What else should I be aware of?

mmjvb’s picture

Im my opinion it is best practice for situations not supporting the use of Composer. It definitely beats manually messing with your installation to get things working. That might have worked for D7, but D8 being based on composer makes that a lot more difficult.

Glad to hear you are willing to look into supporting those that can't use Composer. Haven't found a lot of information on producing a ludwig.json. Suggest to use Composer to assist you in creating one. Make a project with drupal/core and then require your module. Produce the ludwig.json based on the packages installed by that require. The information you need can be found in the composer.lock for each package installed. Suggest to use the distribution url, not the source. The structure is a 'require' with a list of packages, for each package its version and url. Similar to the repository structure.

Obviously, the user must adjust the ludwig.json to his situation. Ludwig won't assist them doing dependency management like Composer does.The versions of packages used are determined at that moment in time. It is a given that things change in time. You might want to remind them about that in your README.

sajosh’s picture

You two are awesome for being open minded to figuring this out.

I just got swiftmailer working without composer or ludwig but it's a hack ...
https://drupal-tools.web.cern.ch/docs/how/use-external-libraries

So I figured I could use the same hack for this module, phpmailer smtp. But alas it doesn't have phpmailer_required.php. Out of luck there.

So, I installed the Ludwig module but it requires a ludwig.json file. So i took a shot at below then put that file in the phpmailer_smtp folder. Then downloaded and placed the phpmailer library into the modules/phpmailer_smtp/lib folder.

No luck.

{
"require": {
"phpmailer_smtp/phpmailer": {
"version" : "v6.1.5",
"url": "https://github.com/PHPMailer/PHPMailer/archive/master.zip"
}
}
}

hhhmm

mmjvb’s picture

Your ludwig.json should be:

{ "require": {
	"phpmailer/phpmailer": {
	       "version": "6.1.5",
                "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/a8bf068f64a580302026e484ee29511f661b2ad3"
	},
	"drupal/phpmailer_smtp": {
	       "version": "1.4.0",
	       "url": "https://ftp.drupal.org/files/projects/phpmailer_smtp-8.x-1.4.zip"
	}
  }
}
imclean’s picture

Status: Active » Needs review
StatusFileSize
new321 bytes

The module itself doesn't need to be in ludwig.json. Patch contains the below code. Please test and let me know if it works.

{
    "require": {
        "phpmailer/phpmailer": {
            "version": "v6.1.5",
            "url": "https://github.com/PHPMailer/PHPMailer/archive/v6.1.5.zip"
        }
    }
}
sajosh’s picture

Thank you both. imclean yours works nicely (#9).

Can't believe the 'v' in 'v6.1.5' is required, perhaps by the Ludwig module. Before imclean's version I was pulling my hair out trying to figure out which directory to put the extracted files into.

For anyone who wants to know the full steps too ...
1. install this phpmailer_smtp module and ludwig module
2. create and add the patch file from #9 or in a blank file copy the code in #9
3. put that file into /modules/phpmailer_smtp folder name it ludwig.json
4. download library at /admin/reports/packages (status should be 'missing')
5. put that file into /modules/phpmailer_smtp/lib/phpmailer-phpmailer/v6.1.5 (don't forget the v)
6. clear cache /admin/config/development/performance
7. check status is 'Installed' /admin/reports/packages

done

Right now i'm debugging why the views_send module isn't sending with phpmailer_smtp. But that's another post, this can be cloased, I think.

  • 354bdd5 committed on 8.x-1.x
    Issue #3133980 by imclean, sajosh, mmjvb: Look into supporting Ludwig to...
imclean’s picture

Status: Needs review » Fixed

Thanks @sajosh and @mmjvb. This is now in the dev version.

imclean’s picture

#10

Right now i'm debugging why the views_send module isn't sending with phpmailer_smtp

Make sure the "Formatter" in "Mail System" is set to something which can handle attachments, such as MIME Mail.

mmjvb’s picture

@imclean Indeed my mistake, it is clearly documented only dependencies need to be required. Thanks for reporting.
@sajosh Thanks for confirmation and reporting the actions to be done.

Thanks for using and supporting Ludwig. With more than 5000 sites reporting that they are using Ludwig, consider it justified.

sajosh’s picture

The problem was me testing with the test server in offline mode. The test emails had the url of the offline test server thus emails not sending or getting delivered.

imclean, your module is super simple to use and setup.

Of the four smtp's I tried (this, just_smtp, swiftmailer, and smtp authentication support), this one has no errors right out of the box, on Drupal 8.8.5. And yours is stable, current, and fewest bugs.

just_smtp kept striping these from emails causing spam score to go up
0.14 MISSING_MID Missing Message-Id: header
1.40 MISSING_DATE Missing Date: header
Plus this is a release candidate 1 for over a year so not stable.

smtp authentication support, also stripped message id and date.
Plus this is just so old and they are hacking in phpmailer v 6.1.5.

Swiftmailer, kept producing this in my emails causing spam score to go up
MIME_QP_LONG_LINE RAW: Quoted-printable line longer than 76 chars

For both plain text and basic html.
Plus it strips out List-Unsubscribe header
Plus this has 76 open bugs while still in alpha2

mmjvb, you're right about ludwig. If composer is so awesome, it should be invisible.

khoebeke’s picture

Can somebody make Ludwig work on phpmailer_smtp v 8.x-1.4 ?

sajosh’s picture

Version: 8.x-1.x-dev » 8.x-1.4

Hi Khoebeke, Yes I tested it on v8.x-1.4, it works. Have you tried it?

sajosh’s picture

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

Indeed, it should work for 8.x-1.4, however the ludwig.json needs to be created yourself. It is not part of that distribution.

imclean’s picture

This is included in 8.x-1.5.

khoebeke’s picture

@sajosh: I tried and it was succesfull!

devad’s picture

Title: Look into supporting Ludwig to download PHPMailer library » PHPMailer SMTP - Add Ludwig integration
jaims-dev’s picture

Thanks a lot all, #10 (@sajosh) did it for me.
Only that for the current version (20201110, PHPMailer-6.1.7) I put the library files in modules/contrib/smtp/lib/phpmailer-phpmailer/^6.1.7

mmjvb’s picture

It should be smtp/lib/phpmailer-phpmailer/6.1.7
depending on the value of version in ludwig.json, which should not be ^6.1.7 but either 6.1.7 or v6.1.7

Actually, the only requirement is that the value of version is a valid folder name. Obviously, it is convenient to put the correct version in there. However, that is not a requirement. It is only used to find the dependency and detect it is there. As long as that folder is mentioned in version, ludwig is happy.

beezer75’s picture

I'm hoping someone on here can help, I previously had this module set up using Ludwig and phpmailer v6.1.5 - After upgrading the SMTP module to v8.x-1.0 Drupal doesn't recognize the phpmailer v6.1.5 library - I can update it via Ludwig at /admin/reports/packages but then I get the following error:

Fatal error: require(): Failed opening required '/code/modules/smtp/lib/phpmailer-phpmailer/v6.1.5/src/SMTP.php' (include_path='/code/vendor/pear/archive_tar:/code/vendor/pear/console_getopt:/code/vendor/pear/pear-core-minimal/src:/code/vendor/pear/pear_exception:.:/usr/share/pear:/usr/share/php') in /code/vendor/symfony/class-loader/ApcClassLoader.php on line 112

Thanks much in advance.

devad’s picture

@Beezer75

Try to manually update SMTP module library dependancy in SMTP module ludwig.json file to "v6.1.7" as well.

Like this:

{
  "require": {
    "phpmailer/phpmailer": {
      "version": "v6.1.7",
      "url": "https://github.com/PHPMailer/PHPMailer/archive/v6.1.7.zip"
    }
  }
}

Please note that current "^" version prefix in SMTP module ludwig.json file could be problematic. It should be "v6.1.7" in both ludwig.json files.

And don't forget to rebuild caches after ludwig.json file is updated and again after all missing libraries are downloaded by Ludwig.

imclean’s picture

@Beezer75, this is the issue queue for the PHPMailer SMTP module. It looks like your question belongs in the SMTP module issue queue.