Comments (5)
Thanks for reporting. This was indeed fixed at some point in #117, but then re-introduced in #163 and missed in the review process.
from service-cli.
Hmm... I guess I was too quick to judge the situation here.
#117 resulted in #142, which lead to that change being reverted back in #149.
Verdict: To use the plain PHP mail()
function with MailHog, you have to set --read-envelope-from
in additional options:
$result = mail($to, $subject, $message, $headers, '--read-envelope-from');
I'm going to mention this in the MailHog integration docs.
from service-cli.
Sorry, but this is not working for me. I tried it with the 5th parameter --read-envelope-from
for the mail function, only -f [email protected]
does it. Did a fin update
before.
I am looking for a variant, which I may can put in the .docksal/etc/php/php.ini
It finally worked with sendmail_path = '/usr/bin/msmtp -t --host=mail --port=1025 -f [email protected]'
in the php.ini
from service-cli.
IDK... Here's the script I'm using for testing:
<?php
$to = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = array(
'From' => '[email protected]', // This one can be dropped if setting`-f [email protected]`
// The rest are optional
// 'Reply-To' => '[email protected]',
// 'X-Mailer' => 'PHP/' . phpversion(),
// 'Return-Path' => '[email protected]',
);
$result = mail($to, $subject, $message, $headers);
// $result = mail($to, $subject, $message, $headers, '--read-envelope-from');
// $result = mail($to, $subject, $message, $headers, '-f [email protected]');
var_dump($result);
Using docksal/cli:php7.4-3.0
image and various combinations of the 5th arg in mail()
vs sendmail_path
in .docksal/etc/php/php.ini
:
; Mail settings
sendmail_path = '/usr/bin/msmtp -t --host=mail --port=1025'
; sendmail_path = '/usr/bin/msmtp -t --host=mail --port=1025 --read-envelope-from'
; sendmail_path = '/usr/bin/msmtp -t --host=mail --port=1025 -f [email protected]'
It only fails when:
- there are no options on either side
- there is
--read-envelope-from
on one side and-f [email protected]
on the other side
All other combinations work just fine for me.
from service-cli.
After giving this more thought, I'm leaning towards setting a default value for --from/-f
in php.ini
in this image.
Something like:
sendmail_path = '/usr/bin/msmtp -t --host=mail --port=1025 --from=docker@cli'
This configuration will allow using PHP's built-in mail()
without extra arguments and it also does not cause issues with Drupal/etc.
from service-cli.
Related Issues (20)
- Need support to install google-chrome in cli container HOT 25
- Drop PHP 7.3
- Terminus v3 and automated login HOT 3
- Ruby version installed doesn't match documentation for release php7.4-3.0 HOT 3
- Switch to Debian 11.0 (bullseye) base image
- CLI image PHP7.4-3.0 has no bundler HOT 1
- Python pip is missing in the v3 images
- Global composer install not setting allowed plugins HOT 1
- "Check custom startup script" sporadic failures in Github Actions CI
- Docker Content Trust for docksal Docker images
- Drupal warning with Php < 8.1.6 HOT 1
- cli stdout logs are too messy HOT 2
- PHP 8.2 HOT 3
- Fix bundled Drush deprecation notices in PHP 8.2 image HOT 2
- ImageMagick 7 HOT 1
- Drop drush-launcher installation from cli container HOT 1
- PHP 8.3 HOT 1
- Stable upstream for PHP 8.3? HOT 2
- Switch to Yarn 4 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from service-cli.