1 taydeko Aug 24, 2008 09:16
3 afwas Aug 25, 2008 23:02
I changed the information in the FAQ. See [url=http://forums.b2evolution.net/viewtopic.php?t=14205][1.10.3] [2.4.0][2.4.2] HOWTO: use an external mailserver
[/url]
Good luck
4 taydeko Aug 26, 2008 06:17
It looks like this may be working except for a couple of small problems. The server I wanted to use was a gmail server and they require SSL and authentication. I searched the documentation and found out how to make the connection, then implemented it.
"Fatal error:
Uncaught Error of type [swift_connectionexception] with message [There was a problem reading line 1 of an SMTP response. The response so far was:
[]. It appears the connection has died without saying goodbye to us! Too many emails in one go perhaps? (fsockopen: #0) ]
@0 comment::send_email_notifications() in /home/.../htsrv/comment_post.php on line 349
@1 send_mail() in /home/.../inc/comments/model/_comment.class.php on line 1240
@2 swift::swift() in /home/.../inc/_core/_misc.funcs.php on line 1594
@3 swift::connect() in /home/.../htsrv/swift-smtp/lib/Swift.php on line 109
in /home/.../htsrv/swift-smtp/lib/Swift/Errors.php on line 99"
The original B2Evo code was commented out. The code from the FAQ was modified to read:
1581 //setup swift-smtp
1582 global $htsrv_path;
1583 require_once( $htsrv_path . '/swift-smtp/lib/Swift.php' );
1584 require_once( $htsrv_path . '/swift-smtp/lib/Swift/Connection/SMTP.php' );
1585 global $smtp_server, $smtp_port, $smtp_user, $smtp_password, $smtp_enc;
1586 $smtp =& new Swift_Connection_SMTP($smtp_server, $smtp_port, $smtp_enc);
1591 $smtp->setUsername( $smtp_user );
1592 $smtp->setpassword( $smtp_password );
1593
1594 $swift =& new Swift($smtp);
1595 $mail =& new Swift_Message( $subject, $message);
$smtp_port is set to 465
$smtp_ecn is set to 'SSL'
The other issue, which may make this all academic is that gmail only allows 50 messages at a time. I guess I would have to loop through my subscribed users. I am new to php and I am not sure how hard this would be.
Just a bit of errata, in your description of this in the FAQ, you show the location of the _misc.funcs.php file as blogs/inc/_misc.funcs.php rather than blogs/inc/_core_misc.funcs.php. It is correct later on in the post.
Thanks!
5 afwas Aug 26, 2008 23:53
From some site that turned up through Google search:
[url=http://bakery.cakephp.org/articles/view/swiftmailer-component-tutorial]SwiftMailer Component Tutorial[/url]
SMTP
This is the default connection type. Here is how to use it:
$this->SwiftMailer->connection = 'smtp'; // default and thus you don't have to specify it
$this->SwiftMailer->smtp_host = 'smtp.gmail.com';
$this->SwiftMailer->smtp_type = 'tls';
if($this->SwiftMailer->connect())
{
// ..
}
$smtp_host is the fully qualified domain name of the server you wish to connect to. Defaults to null in the Component, which means Swift will read the value from php.ini
$smtp_port: The default SMTP port is 25, 465 for SSL. It is set to false in the Component, to let Swift choose the value depending on $smtp_type. Set it to null to tell Swift to read the value from php.ini
$smtp_type Can be one of the following values: 'open', 'ssl', 'tls'.
Depending on your SMTP server, you should set this value accordingly.
By the way Gmail uses TLS.
Auth
If your server requires authetication, you can set up your username and password by doing the following:
$this->SwiftMailer->username = 'user@gmail.com';
$this->SwiftMailer->password = 'secret';
" Depending on your server, your username might be 'user' or 'user@domain.tld'."
I can't remember if I ever succeeded with setting up gmail. I advise you to search the web and find similar sites with swift specific information. Of course I can't help you with a 50 email limit from Gmail.
Good luck
I'll have a look. Will answer tomorrow.
Good luck