Now that the SwiftMailer.php file is no longer there, how does one add TLS authentification? Is it just a case of adding the "$wgSMTPAuthenticationMethod = 'tls'" to LocalSettings.php?
Extension talk:SwiftMailer
Appearance
Sorry for the delay, but configuration updated in https://www.mediawiki.org/w/index.php?title=Extension:SwiftMailer&type=revision&diff=3367559&oldid=3084390&diffmode=source
Hi, I tried installing this but it's complaining that "extension.json" is not in the SwiftMailer extension folder, which is true. Am I missing something?
wfLoadExtension( 'SwiftMailer' ); in LocalSettings.php wont work, but if you add
require_once "$IP/extensions/SwiftMailer/SwiftMailer.php";
instead, it should work.
In the current Download the program SwiftMailer.php appears to be missing (this causing a 500 error if instructions followed).
Is the program missing from the package, or do instructions need updating?
We dropped support for that inclusion in https://github.com/wikimedia/mediawiki-extensions-SwiftMailer/commit/a92cc5ce9c004493a600ed857e975bf6a1a9cd74
Now, you have to add wfLoadExtension( 'SwiftMailer' );
in your LocalSettings.php
to use the extension.
Thank you!
Anyone have similar error?
PHP Notice: fwrite(): send of 33 bytes failed with errno=32 Broken pipe in /extensions/SwiftMailer/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php on line 232
Seems like it couldn't be configured. But how can I use remote mail server?
Extension:SwiftMailer takes in the original SMTP mail server credentials using the $wgSMTP array values given in LocalSettings.php ( Manual:$wgSMTP#Details ) .
Once you have installed the extension, mails will get send by SwiftMailer using these credentials, with an additional option of $wgSMTPAuthenticationMethod = 'tls'; in case you want to enable TLS in SwiftMailer.php ( Extension:SwiftMailer).
Thanks for clearing up. But I experience some great troubles using SwiftMailer with configured $wgSMTP. Probably, it's not because of this, while it happened just after these changes. Host just don't do any response. Without specified parameters host works well and it shows it have sent e-mail, while it doesn't, in fact.
OK, now everything works. Who knew I must install EXIM (or any MTA) to use feature of mailing? I'm a lunatic. :-)
Ok I an experiencing much the same issues as many other have reported namely I have setup the Swiftmailer extension completely in accordance with all the config information.
I have a bog standard Ubuntu build (14.04) and the latest MediaWiki/BlueSpice installation and PHP5 with Apache2
All the $wgSMTP parameters in LocalSettings.php including the require statement and Swiftmailer.php are there as per the extension documentation
I have set up SwiftMailer to do SMTP authentication = "ssl" with $wgSMTP using port 465 (its actually mail.btinternet.com
The only thing that is not 100% clear is IDHost parameter (set to btinternet.com?)
All I get when attempting to send a confirmation email is [bbe3ce2d] 2016-06-16 14:25:11: Fatal exception of type "MWException"
From across the internet I find many similar experiences from other but no clear rationale or solutions, some of them seem to be resolved almost by magic ("it just started working")
Does anyone have a DEFINITIVE solution to this problem?
Regards Colin
Sad to hear that you are experiencing such a problem. To dig more into it, can you enable more debug on fatals by $wgShowExceptionDetails = true; in LocalSettings.php, and paste in the stacktrace (only if its not-sensitive. If it contains sensitive items, please do mail me the same at 01tonythomas[at]gmail[dot]com
This is the detail of the error I got back
[468ba65d] /index.php/Special:ConfirmEmail MWException from line 291 of /var/www/npdproject.ddns.net/includes/mail/UserMailer.php: PEAR mail package is not installed
Backtrace:
#0 /var/www/npdproject.ddns.net/includes/User.php(4263): UserMailer::send(MailAddress, MailAddress, string, string, array)
#1 /var/www/npdproject.ddns.net/includes/User.php(4236): User->sendMail(string, string)
#2 /var/www/npdproject.ddns.net/includes/specials/SpecialConfirmemail.php(84): User->sendConfirmationMail()
#3 /var/www/npdproject.ddns.net/includes/specials/SpecialConfirmemail.php(65): EmailConfirmation->showRequestForm()
#4 /var/www/npdproject.ddns.net/includes/specialpage/SpecialPage.php(384): EmailConfirmation->execute(NULL)
#5 /var/www/npdproject.ddns.net/includes/specialpage/SpecialPageFactory.php(553): SpecialPage->run(NULL)
#6 /var/www/npdproject.ddns.net/includes/MediaWiki.php(281): SpecialPageFactory::executePath(Title, RequestContext)
#7 /var/www/npdproject.ddns.net/includes/MediaWiki.php(714): MediaWiki->performRequest()
#8 /var/www/npdproject.ddns.net/includes/MediaWiki.php(508): MediaWiki->main()
#9 /var/www/npdproject.ddns.net/index.php(41): MediaWiki->run()
#10 {main}
I'm having this problem as well. It looks like it's still wanting to use PEAR mail package.
Solved! I had to match the EmergencyContact and PasswordSender values to the email address used in wgSMTP.
I spoke too soon. So emails seem to get sent if it's originating from the address that's set in $wgSMTP, but if for example I try to send a user-to-user email, it fails with the same message. If I configure $wgSMTP for that user's email, then it works again. In essence, it currently is working for a single source email address.
You may be right,
Looking at the code ( UserMailer.php in includes/mail I found the section where it checks to see if $wgSMTP is there and if it is checks for PEAR and throws the error above if false. I am assuming that this is where SwiftMailer needs to hook in? but I am a bit of a noob with all this PHP stuff so I am near to the limit of what I understand is happening, although I suspect that it is something to do with getting SwiftMailerHooks.php to intercept at this point posing as the PEAR mailer?
That sounds logical but I'm a total newbie to Mediawiki and Extensions as well. One workaround that seems to work currently is setting $wgNoReplyAddress to the same address, and to set $wgUserEmailUseReplyTo = true.
Well, we hook in swiftmailer right in https://github.com/wikimedia/mediawiki/blob/master/includes/mail/UserMailer.php#L337 -- before we check for Pear. If the email went alright with SwiftMailer, then the rest of the sendInternal() function is ignored.
Okey. I ran the whole process in my local with Gmail smtp server settings, after uninstalling pear-mail from my machine. It seemed to work. Let me paste in some observations I found:
- It seems to fatal and use PEAR when I chose 'port' => 465 and $wgSMTPAuthenticationMethod = "tls"; According to the docs at https://support.google.com/a/answer/176600?hl=en, on 465, it expects TLS, and setting the global to tls solved my issue.
- I have $wgUserEmailUseReplyTo = false; and it was correctly sending emails between users ( using Special:EmailUser) and to the same user (via Special:ConfirmEmail).
If you are unsure, please run a $ git pull origin master in your SwiftMailer code and then composer update, followed by the correct SSL or TLS settings in your SwiftMailer.php. If it still fails, please do email me in the above mail address, and we can have maybe a teamviewer session to understand what is going wrong.
Hi Tony, thanks for looking into this so quickly, and thanks for confirming that PEAR Mail is indeed used as a fallback, which is why we see those error messages. Perhaps this bit of information can make it to the Extension page? Several threads here note that very problem. It's quite misleading since we think it's an installation issue when in fact it's a configuration issue.
Anyways, I'll be testing this extension over the next couple of days and will make sure to note any issues here. Thanks again! Hope this extension makes it into core.
Hi Tony
Thanks for the insights.
I actually removed and reinstalled the extension (SwiftMailer-REL1_26-07e9cf2)
Followed the set up as per documentation, ran composer update set up for 465 port and ssl
Same result.
I have spent some time trying to unerstand hooks and think I now understand how they work.
I looked at UserMailer and think I understand what is going on, however looking at the script I don't understand how newGood() returns a false value unlike (newFatal ( 'error msg' , $ret)
as per
$ret = Hooks::run( 'AlternateUserMailer', [ $headers, $to, $from, $subject, $body ] );
if ( $ret === false ) {
// the hook implementation will return false to skip regular mail sending
return Status::newGood();
} elseif ( $ret !== true ) {
// the hook implementation will return a string to pass an error message
return Status::newFatal( 'php-mail-error', $ret );}
I am assuming if SwiftMailer returns a false value then UserMailer sets Status to newGood()
If SwiftMailer returns a true value then UserMailer sets Status (newFatal('php-mail-error', $ret)
The SwiftMailer code SwiftMailerHooks puts out wfDebugLog and wfDebug messages as it goes along. It might be useful to check progress of SwiftMailer except not sure where to find them
Is there any simple(dummy level) way to debug SwiftMailer return values?
Colin
Yippee Success.
Got the $wfdebug logging working which allowed me to find where the error was being made.
As a long time Windows user it is taking me a long time to get used to case sensitivity especially the regular use of capitalisation in Unix ...............So for example SwiftMailer vrs Swiftmailer vrs swiftmailer which in Windows would often be regarded as the same
MyError was 'Port' not 'port' in $wgSMTP causing SwiftMailerHooks.php to error.
Often the simplest things get overlooked especially in unfamiliar terrority!
All working now message sent
Many thanks to Tony for helping me find my way through this.
Colin
Glad to know. I think there would be some config issue in the above cases too.
SwiftMailer is loaded in the versions special page.
Wiki gives this error: [0ddb29d7] /wiki/index.php/Especial:Alterar_e-mail MWException from line 291 of /var/www/wiki/includes/mail/UserMailer.php: PEAR mail package is not installed
Installed composer.phar and run in the SwiftMailer page, and the output was this:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
Looks like SwiftMailer cannot send email correctly from your wiki. Please see the updated docs at Extension:SwiftMailer#Configuration and update your LocalSettings.php accordingly with $wgSMTP settings.
Now every thing works fine, but I don't know why!
The wiki errors should have more useful information...
Thanks!
Any idea what you did to make this work? I'm having the same problem.
Hey guys,
I'm running MediaWiki 1.26.3 with PHP 7 on Windows platform.
i'm trying to make the smtp functionality to work with Gmail account and tried PEAR mail & net_smtp method but however it didn't work.(fail to connect to smtp.gmail.com:25 with TLS)
So I tried the second method, which is SwiftMailer. I could see it shown in the Version:Special Page as "SwiftMailer 1.0 GPL-2.0" and I did specify "$wgSMTPAuthenticationMethod = 'tls';" in SwiftMailer.php but however it didn't work.
It gives the error msg when I try to use the Password recovery by email function. it says "[fe7c6382] 2016-06-07 16:53:37: 嚴重例外類型 "MWException"
Any suggestions?
Thanks!
Okey. So, taking a look at your previous error message -- (fail to connect to smtp.gmail.com:25 with TLS) -- are you sure your firewall is allowing access to port 25 ?
Please try telnet smtp.gmail.com 25 from your host machine and tell me if you get something like Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
220 smtp.gmail.com ESMTP c16sm2563090pfb.33 - gsmtp
This post was hidden by 01tonythomas (history)
Hi TonyThomas,
Thanks for your reply.
Yes. i can connect to smtp.gmail.com:25 without problem by telnet client.
when i was using PEAR mail functionality, it gives this error:
Failed to connect to ssl://smtp.gmail.com:25 [SMTP: Failed to connect socket: fsockopen(): unable to connect to ssl://smtp.gmail.com:25 (Unknown error) (code: -1, response: )]
And i don't really know how to solve this problem. If i don't use "ssl://" prefix then it won't proceed with STARTTLS. :(
I am using HHVM and there are some problem with pear so that I can't send email with $wgSMTP (which require pear mail function)
I tried to set this extension up. It could send email directly from server but not work at all when $wgSMTP used.
Created https://phabricator.wikimedia.org/T100284 Thanks for finding out
MW 1.24.1 with the current master version SwiftMailer 5/25/2015, does not work with HHVM 3.6
But it work with HHVM 3.7.
I guess this is a HHVM problem. Anyway it work now. Thank you!
There are no older topics