Recent Topics

1 Jan 27, 2008 23:34    

My b2evolution Version: 1.10.x

I am running b2 on my own server.
I have an smtp server to use smtp.att.yahoo.com
I am using Apache 2.2.8
I am using PHP 5.2.5
I am using Windows 2003 server
I am getting the following error:
Sorry, the email with the link to validate and activate your password could not be sent.
Possible reason: the PHP mail() function may have been disabled on the server.

Can PHP mail() function be used or how do I make this work?
Thanks
Dan

3 Jan 28, 2008 04:19

I am just starting my board and testing.
I don't know when I am suppose to get emails.
However I created a post and left a comment and as an admin I did not receive any emails or leaving a comment with a different email address I did not receive any emails.
Thanks
Dan

4 Jan 28, 2008 04:32

It seems like the mail function is disabled on your host.

Try to create php file with this content and run it

<?php
error_reporting(E_ALL);
ini_set('display_errors', 'on');

$email = "real@email.com";
$subject = "Welcome";
$message = "Welcome message";
$headers = 'From: any@email.org' . "\n" .
'Reply-To: any@email.org' . "\n" .
'X-mailer: php/' . phpversion();

$r = mail($email, $subject, $message, $headers);
var_dump($r);
?>

5 Jan 28, 2008 13:43

Here is what I get after doing that.
Warning: mail(): SMTP server response: 530 authentication required - for help go to http://help.yahoo.com/help/us/sbc/dsl/mail/pop/pop-11.html in D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\phpmailtest.php on line 12 bool(false)

It looks like for this to work I need to add code to take care of Authentication for my ISP.

7 Jan 29, 2008 03:16

I have read all these links and I don't understand how to fix my problem from the answers in theses links. My error messege is not in these links.
Thanks

8 Jan 29, 2008 06:14

Hi,

The solution is posted at http://forums.b2evolution.net/viewtopic.php?t=11607&highlight=smtp

I copied the key lines here

add 3 lines to the _advanced.php file in the blogs/conf/ directory:

ini_set("SMTP","mail.PutYourSMTPServerNameHere.com");
ini_set("smtp_port","25"); // assuming standard Port 25 for SMTP
ini_set("sendmail_from","YourEMailHere@YourDomain.com");

Thank you jackmang

9 Jan 29, 2008 06:19

If it won't send emails with smtp_port 25, try to use 465 instead.

10 Jan 29, 2008 13:03

OK let's see where we are at.
First I added the code in the advanced.php and got the same error I started with saying that mail() function may be disabled on my server.

I modified the test php file to include the Authorization as follows and that did not work either see below
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'on');

$email = "xxxxxxxx@xxxxxxx.com";
$subject = "Welcome";
$message = "Welcome message";
$SMTPAuth = true; // turn on SMTP authentication
$Username = "xxxxxxx@sbcglobal.net"; // SMTP username
$Password = "xxxxxxx"; // SMTP password
$headers = 'From: xxxxxxxx@sbcglobal.net' . "\n" .
'Reply-To: xxxxx@xxxxxxxx.com' . "\n" .
'X-mailer: php/' . phpversion();

$r = mail($email, $subject, $message, $headers, $SMTPAuth, $Username, $Password);
var_dump($r);
?>

after running this I received the following error.
Warning: mail() expects at most 5 parameters, 7 given in D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\phpmailtest.php on line 15 NULL

I did this based on the previous error I received when running this test.php file.

This is where I think I am at.
1. I need to get the Auth code to work since my ISP requires it to send mail.
2. After that is working then I need to modify the code somewhere that b2 will use it.

Can you guys help with this and do you think I am on the right track?

I appreciate all the help.
Thanks
Dan

11 Jan 29, 2008 13:31

Put this in Windows/php.ini

SMTP = smtp.att.yahoo.com
smtp_port = 465
sendmail_from = your@yahoo.email
auth_username =
auth_password =

And try to run it again

<?php
error_reporting(E_ALL);
ini_set('display_errors', 'on');

$email = "real@email.com";
$subject = "Welcome";
$message = "Welcome message";
$headers = 'From: your@yahoo.email' . "\n" .
'Reply-To: your@yahoo.email' . "\n" .
'X-mailer: php/' . phpversion();

$r = mail($email, $subject, $message, $headers);
var_dump($r);
?>

12 Jan 29, 2008 13:39

bool mail  ( string $to  , string $subject  , string $message  [, string $additional_headers  [, string $additional_parameters  ]] )


see: http://php.net/function.mail

I doubt if you get this running with the mail() function. But please do prove me wrong.

Good luck

13 Jan 29, 2008 13:46

OK I am still getting the following error after rerunning the test.php:

Warning: mail(): SMTP server response: 530 authentication required - for help go to http://help.yahoo.com/help/us/sbc/dsl/mail/pop/pop-11.html in D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\phpmailtest.php on line 12 bool(false)

I changed the php.ini to look like this:
[mail function]
; For Win32 only.
SMTP = smtp.att.yahoo.com
smtp_port = 25
sendmail_from = xxxxxxx@sbcglobal.net
auth_username = xxxxxx@sbcglobal.net
auth_password = xxxxxxx

and restarted Apache to reread the new php.ini
so I think I did everything right.

thanks
dan

14 Jan 29, 2008 13:53

try with smtp_port = 465

15 Jan 29, 2008 14:06

With changing the port now I get this error:

Warning: mail(): Failed to connect to mailserver at "smtp.att.yahoo.com" port 465, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\phpmailtest.php on line 12 bool(false)

16 Jan 29, 2008 14:17

Maybe it's time for Yahoo support? ;)

17 Jan 29, 2008 14:23

I can send mail from outlook just fine. So I don't think yahoo is the problem.
I have also tested phpmailer and this works:

<?php
require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP();
$mail->Host = "smtp.att.yahoo.com";
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "xxxxxxx@sbcglobal.net"; // SMTP username
$mail->Password = "xxxxxxx"; // SMTP password

$mail->From = "xxxxxx@xxxxxxx.com";
$mail->FromName = "Dan";
$mail->AddAddress("xxxxxxx@xxxxxxxx","Dan");
$mail->AddReplyTo("xxxxx@xxxxxxxx.com", "Dan");
if(!$mail->Send())
{
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
{
echo 'Message has been sent.';
}
?>

18 Jan 29, 2008 14:50

phpMailer will work, but I'm not sure it works with Yahoo! The question is whether Yahoo! requires SSL or SLT authentication (if you can send through port 25 it usually doesn't). phpMailer doesn't work with SSL nor SLT, so Gmail won't work.
V-nessa wrote the connection from B2evo to phpMailer. See http://www.v-nessa.net/2007/08/08/b2evolution-smtp-patch with a patch (before you run, check versions) If you use another version of B2evo, you need to redo the hacks. That's in three files inc/MODEL/comments/_comment.class.php and inc/MODEL/items/_item.class.php and inc/MODEL/users/_user.class.php

This is a solution I know will work. Unfortunately phpMailer lacks a few options and is no longer maintained. For these two reasons it is decided not to include phpMailer into B2evo.

Good luck

19 Jan 29, 2008 17:04

I had a successful go with [url=http://www.swiftmailer.org/]swift mailer[/url] in B2evo 1.10.3. This is how to set it up:

1) Download swift-smtp from http://www.swiftmailer.org/download/ . Unpack and upload the /lib/ folder. I made a directory in /inc/_misc/ called swift-smtp where I put the lib folder. Feel free to add the folder to /htsrv/ where I think it belongs.
2) Open /inc/_misc/_misc.funcs.php and replace lines 2348 - 2362:

	if( $debug > 1 )
	{	// We agree to die for debugging...
		if( ! mail( $to, $subject, $message, $headerstring ) )
		{
			debug_die( 'Sending mail from
 &laquo;'.htmlspecialchars($from).'&raquo; to
 &laquo;'.htmlspecialchars($to).'&raquo;, Subject
 &laquo;'.htmlspecialchars($subject).'&raquo; FAILED.' );
		}
	}
	else
	{	// Soft debugging only....
		if( ! @mail( $to, $subject, $message, $headerstring ) )
		{
			$Debuglog->add( 'Sending mail from
 &laquo;'.htmlspecialchars($from).'&raquo; to
 &laquo;'.htmlspecialchars($to).'&raquo;, Subject
 &laquo;'.htmlspecialchars($subject).'&raquo; FAILED.', 'error' );
			return false;
		}
	}


by:

//setup swift-smtp
    require_once( dirname(__FILE__).'/swift-smtp/lib/Swift.php' );
    require_once( dirname(__FILE__).'/swift-smtp/lib/Swift/Connection/SMTP.php' );
    global $smtp_server, $smtp_user, $smtp_password, $smtp_port;
    $smtp =& new Swift_Connection_SMTP( $smtp_server, $smtp_port);
    $smtp->setUsername( $smtp_user );
    $smtp->setpassword( $smtp_password );

    $swift =& new Swift($smtp);
    $mail =& new Swift_Message( $subject, $message);

    $to_name = preg_replace( '/^.*?<(.+?)>$/', '$0', $to );
    $from_name = preg_replace( '/^.*?<(.+?)>$/', '$0', $from );
    $to_email = preg_replace( '/^.*?<(.+?)>$/', '$1', $to );
    $from_email = preg_replace( '/^.*?<(.+?)>$/', '$1', $from );

    $new_to = new Swift_Address( $to_email, $to_name );
    $new_from = new Swift_Address( $from_email, $from_name );

    if( $debug > 1 )
    {    // We agree to die for debugging...
        if( ! $swift->send( $mail, $new_to, $new_from ))
        {
            debug_die( 'Sending mail from
 &laquo;'.htmlspecialchars($from).'&raquo; to
 &laquo;'.htmlspecialchars($to).'&raquo;, Subject
 &laquo;'.htmlspecialchars($subject).'&raquo; FAILED.' );
        }
    }
    else
    {    // Soft debugging only....
        if( ! @$swift->send( $mail, $new_to, $new_from ))
        {
        $Debuglog->add( 'Sending mail from
 &laquo;'.htmlspecialchars($from).'&raquo; to
 &laquo;'.htmlspecialchars($to).'&raquo;, Subject
 &laquo;'.htmlspecialchars($subject).'&raquo; FAILED.', 'error' );
            return false;
        }
    }


I prefer the variables in /conf/_advanced.conf. Somewhere put this block:

/**
 * SMTP
 * uses swift-smtp
 */
$smtp_server = 'smtp.server.tld';
$smtp_port = 25;
$smtp_user = 'user';
$smtp_password = 'password';


Please do report back if it works.

Good luck

20 Jan 29, 2008 18:10

I tested and it works in B2evo 2.4 also.
In 2.4 you are looking for inc/misc/_misc.funcs.php line ~1568 ++ to change.

21 Jan 30, 2008 04:47

After adding the code from above and trying to register I am not getting an email and it finishes with a blank page.
I put the files under the htsrv directory.
Do I have to change any of the code if I put it there?
thanks
Dan

22 Jan 30, 2008 05:31

Yes,

You can try these lines (replaces similar lines in code):

require_once( dirname(dirname(dirname(__FILE__))).'/htsrv/swift-smtp/lib/Swift.php' );
require_once( dirname(dirname(dirname(__FILE__))).'/htsrv/swift-smtp/lib/Swift/Connection/SMTP.php' );

Good luck

*edit*
Once again: I took the /lib/ folder from the package and put it in a custom made /swift-smtp/ folder. You may copy the /lib/ folder from swift-smtp directly to the /htsrv/ folder, but change the path accordingly.

23 Jan 30, 2008 13:49

My path is exactly as you show but I still am left with a blank page and no email.
I must have something else not working or wrong.
this is getting very frustrating.
I appreciate your patience with me.
what else can I try or check?
Thanks
Dan

25 Jan 31, 2008 03:38

Ok I still can't get this to work

Here is the info I have

php.ini memory setting:
memory_limit = 128M

snapshot of your code in _misc.funcs.php:
//setup swift-smtp
require_once( dirname(__FILE__).'/htsrv/swift-smtp/lib/Swift.php' );
require_once(dirname(__FILE__).'/htsrv/swift-smtp/lib/Swift/Connection/SMTP.php' );

Path to files:
Z:\Program Files\Apache Software Foundation\Apache2.2\htdocs\weblog\blogs\htsrv\swift-smtp\lib

If you need any other info let me know.
Thanks
Dan

26 Jan 31, 2008 06:43

I GOT IT TO WORK ....... YEA

What I had to do is follow you original idea of putting the swift-smtp folder
under the inc folder.

require_once( dirname(__FILE__).'/swift-smtp/lib/Swift.php' );
require_once( dirname(__FILE__).'/swift-smtp/lib/Swift/Connection/SMTP.php' );

This then worked and sent the email and then validated it and it works fine.

Thank you so much.
Dan

27 Jan 31, 2008 06:44

Cool, very cool.

If the files are in /inc/_misc/swift-smtp/lib/ then you do:

require_once( dirname(__FILE__).'/swift-smtp/lib/Swift.php' );


if the files are in /htsrv/swift-smtp/lib/ then you do:

require_once( dirname( dirname( dirname(__FILE__))).'/swift-smtp/lib/Swift.php' );

Happy blogging :p

28 Feb 01, 2008 07:27

== UPDATE ==
Very unfortunately I found a bug when it is trying to send to and from 'fancy emailaddresses' like 'somebody <someone@something.org>'. The code presented above is the corrected one.
In the [url=http://forums.b2evolution.net/viewtopic.php?t=14205]FAQ[/url] I wrote a HOWTO which is probably easier to read than this conversation.

Good luck

29 Apr 22, 2008 07:23

Sorry to resurrect this thread, Just a couple of little problems.
Problem 1: 2.4.1's directories are organised differently! So, is that affecting how I'm modifying this? I've put the swift thing in the htsrv directory.
Problem 2: 2.4.1 does not have an /_advance.conf.php file. so where does this code go? Also, As stupid as this next question is I have no idea where to put the login details (see my added comments) All I know is that I can't get this to work and I do not know where I'm going wrong. .

/**
 * SMTP
 * uses swift-smtp
 */
$smtp_server = 'smtp.server.tld';//WHAT DO I PUT HERE?
$smtp_port = 25;
$smtp_user = 'user';//IS THIS WHERE I PUT MY USERNAME?
$smtp_password = 'password'; //IS THIS WHERE I PUT MY PASSWORD?

It looks straight forward enough but I'm sooo confused!
I'm only a basic webmaster, that is I try to follow simple instructions on forums.

30 Apr 25, 2008 04:33

I just started trying to do this in 2.4.1. I followed 'afwas'
advice and used that code and modified it in the advanced.php file using the settings that I work in my email account.

Note to steven1972: the _misc.funcs.php file is actually in inc/_core/ directory, at least in my installation of 2.4.1.
Instead of using the advanced.conf file, I changed the _advanced.php file.

HOWEVER:
I now get the following error:

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 send_mail() in /home/thewee6/public_html/testblog/htsrv/register.php on line 166
@1 swift::swift() in /home/thewee6/public_html/testblog/inc/_core/_misc.funcs.php on line 1592
@2 swift::connect() in /home/thewee6/public_html/testblog/inc/_core/swift-smtp/lib/Swift.php on line 109

in /home/thewee6/public_html/testblog/inc/_core/swift-smtp/lib/Swift/Errors.php on line 99

The line 1592 is so far below b/c I just commented out the existing code instead of overwriting it.
I do have to use ssl according to my isp. I don't know if that will make a difference.

Thanks in advance.

31 Apr 29, 2008 20:38

Hi, Just wanted to see if anyone might be able to give me a pointer on what I may be doing wrong. I've checked all the simple stuff like correct directory structure and spelling.
Is there something else I need to pass for SSL? Something I need to configure in Swift?

Also, this is from an add-on domain. I read that this can be a problem for Wordpress, but is it a problem for b2e as well?

Thanks to anyone that has some ideas.

H.

32 May 06, 2008 11:27

I don't want to open a new topic, because I get the same error message

Sorry, could not send email.
Possible reason: the PHP mail() function may have been disabled on the server.

I tested the short php program

<?php
error_reporting(E_ALL);
ini_set('display_errors', 'on');

$email = "forum@dejung.net";
$subject = "Welcome";
$message = "Welcome message";
$headers = 'From: any@email.org' . "\n" .
'Reply-To: any@email.org' . "\n" .
'X-mailer: php/' . phpversion();

$r = mail($email, $subject, $message, $headers);
var_dump($r);
?>


and it works, fine. I'm not sure why I get this error message, when I try to answer at postings.

The blog address is http://may25th.de

Any ideas?

33 May 24, 2008 17:22

Hi,

I am having the same problems. I get emails from the Comment form and when someone posts or comments to a post. But when someone tries to register, the validation email is not sent and the "mail () function may be disabled by your host" shows up (but in Spanish) which is weird since emails are being sent from other processes of the blog.

I uploaded ran the small php file and got a bool(true) message and the email was actually received.

I tried to include the three lines in php.ini using the right smtp server at bluehost and the smtp port used by bluehost (26), but no luck.

I would like to thank you in advance for any help you could provide,

pisto

34 Jun 02, 2008 19:20

I'm also getting this exact error.

New current install of b2Evolution (hosted locally on my company domain)
Windows 2003 Server
IIS6
PHP 5.1.4
Microsoft Exchange Server (hosted locally on my company domain)

I should also add that to test mail functionality I submitted several test emails from my company website contact forms which had been working in the past, but now they are not working either. I've changed nothing on my server that would have prevented phpmail from working. The SMTP server and port have never changed.

Here's my info.php if anyone wants to look at it to see if you can spot anything I'm overlooking.

http://www.alaron-nuclear.com/info.php

//update. my SMTP server in php.ini has always been alaron-nuclear.com
When I ran the simple mail test it failed.
I changed it to an absolute path http://www.alaron-nuclear.com
When I ran the simple mail test it failed.

However, when I changed the SMTP server in php.ini to the exchange server name alaron-sbs-01 it worked. Problem solved !!!!!!!!!

35 Nov 27, 2014 14:19

THIS FIX NO LONGER APPLIES TO VERSION 5.1.2..

@blouwagie wrote earlier:

Hi,

The solution is posted at http://forums.b2evolution.net/viewtopic.php?t=11607&highlight=smtp

I copied the key lines here

add 3 lines to the _advanced.php file in the blogs/conf/ directory:

ini_set("SMTP","mail.PutYourSMTPServerNameHere.com");
ini_set("smtp_port","25"); // assuming standard Port 25 for SMTP
ini_set("sendmail_from","YourEMailHere@YourDomain.com");

Thank you jackmang

36 Jun 06, 2015 17:45

I know I'm raising a bit of a zombie thread here. but is there an appropriate fix detailed anywhere that works for 5.1.2 or higher? I dont need it myself, but I know some who's trying b2evo for the first time at the moment, and is have issues on the email side of things once he changed the default address on the admin account.

For the moment, I've suggested he re-run the install and change the email address there, but it would be handy to know.

@pnair39 wrote earlier:

THIS FIX NO LONGER APPLIES TO VERSION 5.1.2..

@blouwagie wrote earlier:

Hi,

The solution is posted at http://forums.b2evolution.net/viewtopic.php?t=11607&highlight=smtp

I copied the key lines here

add 3 lines to the _advanced.php file in the blogs/conf/ directory:

ini_set("SMTP","mail.PutYourSMTPServerNameHere.com");
ini_set("smtp_port","25"); // assuming standard Port 25 for SMTP
ini_set("sendmail_from","YourEMailHere@YourDomain.com");

Thank you jackmang

37 Jun 08, 2015 08:03

No matter if it works or not, the SMTP trick is not needed anymore, since b2evolution v6 has its own built-in SMTP gateway (http://b2evolution.net/man/smtp-gateway-settings).

@chris_of_arabia there are many threads in this forums regarding email issues. Your friend can also change his email address by hand, directly into the database. But, what kind of information are you exactly asking for?


Form is loading...