Extension talk:SwiftMailer

About this board

195.159.223.106 (talkcontribs)

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?

01tonythomas (talkcontribs)
Reply to "TLS authentification"
Ernsheong (talkcontribs)

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?

01tonythomas (talkcontribs)

wfLoadExtension( 'SwiftMailer' ); in LocalSettings.php wont work, but if you add

require_once "$IP/extensions/SwiftMailer/SwiftMailer.php";

instead, it should work.

2A00:23C5:D000:3000:55BC:95DD:1084:8D64 (talkcontribs)

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?

01tonythomas (talkcontribs)
Reply to "Install error"

PHP Notice:  fwrite(): send of 33 bytes failed with errno=32 Broken pipe

1
Deletedaccount4567435 (talkcontribs)

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

Reply to "PHP Notice:  fwrite(): send of 33 bytes failed with errno=32 Broken pipe"

And how to set up SMTP authentication?

18
Атомный трамвай (talkcontribs)

Seems like it couldn't be configured. But how can I use remote mail server?

01tonythomas (talkcontribs)

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).

Атомный трамвай (talkcontribs)

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.

Атомный трамвай (talkcontribs)

OK, now everything works. Who knew I must install EXIM (or any MTA) to use feature of mailing? I'm a lunatic. :-)

86.148.157.239 (talkcontribs)

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

01tonythomas (talkcontribs)

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

86.148.157.239 (talkcontribs)

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}

Norwin88 (talkcontribs)

I'm having this problem as well. It looks like it's still wanting to use PEAR mail package.

Norwin88 (talkcontribs)

Solved! I had to match the EmergencyContact and PasswordSender values to the email address used in wgSMTP.

Norwin88 (talkcontribs)

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.

86.148.157.239 (talkcontribs)

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?

Norwin88 (talkcontribs)

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.

01tonythomas (talkcontribs)
01tonythomas (talkcontribs)

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.

Norwin88 (talkcontribs)

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.

86.148.157.239 (talkcontribs)

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

86.148.157.239 (talkcontribs)

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

01tonythomas (talkcontribs)

Glad to know. I think there would be some config issue in the above cases too.

Reply to "And how to set up SMTP authentication?"

Installation OK, but wiki keeps trying to use PARS

4
95.94.93.67 (talkcontribs)

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

01tonythomas (talkcontribs)

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.

94.62.87.205 (talkcontribs)

Now every thing works fine, but I don't know why!

The wiki errors should have more useful information...

Thanks!

Loucubrate (talkcontribs)

Any idea what you did to make this work? I'm having the same problem.

Reply to "Installation OK, but wiki keeps trying to use PARS"

install OK, Could be seen in Versions:Special page, but not working.

4
Ychuangtw (talkcontribs)

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!

01tonythomas (talkcontribs)

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)
114.34.58.226 (talkcontribs)

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. :(

Reply to "install OK, Could be seen in Versions:Special page, but not working."

Is it possible to use this extension send SMTP mail?

3
Deletedaccount4567435 (talkcontribs)

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.

01tonythomas (talkcontribs)
Deletedaccount4567435 (talkcontribs)

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!

Reply to "Is it possible to use this extension send SMTP mail?"
There are no older topics