Forum Moderators: coopster

Message Too Old, No Replies

Email problem with phpBB

Error message when someone registers or when I try "mass email" function

         

jetnovo

10:00 pm on May 11, 2004 (gmt 0)

10+ Year Member



Hi there
I'm brand new to bulletin boards (and php), and I appear to be having a reasonably common problem with phpBB - but nowhere on the web can I find the steps necessary to fix it.

I've spent most of yesterday hunting through the support forums for help but nothing that's written at a basic enough level.

Currently I'm configured NOT to use SMTP for email. I've tried using SMTP and it doesn't work.

I have "Use SMTP server for email" turned OFF and have the "SMTP Username" and "SMTP Password" fields blank.

I checked and my phpBB forum is hosted on a Linux server.

But when someone registers on the BB, or when I use the mass email function, I get the following error message (interestingly though, the email still goes though)...

------------------------------------------------------------------

Failed sending email :: PHP ::

DEBUG MODE

Line : 234
File : /var/www/ocoloco/awj42650/htdocs/phpBB2/includes/emailer.php

------------------------------------------------------------------

I don't understand this, and when I look at line 234 of the code I don't know what to do anyway.

Line 234 looks like this:

------------------------------------------------------------------

message_die(GENERAL_ERROR, 'Failed sending email :: ' . (($this->use_smtp)? 'SMTP' : 'PHP') . ' :: ' . $result, '', __LINE__, __FILE__);

------------------------------------------------------------------

Can anyone please help? The forum is otherwise working brilliantly, it's a shame this last thing seems imposisble to fix.

Again, I'm incredibly new to all of this so extremely simple instructions would be so massively appreciated, thanks! :)

jatar_k

10:05 pm on May 11, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



looks like it can't find the mail server.

Does it mention how to configure phpbb to use the mail server?

are you on a windows or *nix box?

can you use the mail function in a php script outside of phpbb?

jetnovo

10:10 pm on May 11, 2004 (gmt 0)

10+ Year Member



Hi Jatar

Thanks for your help. I'm on a Linux server, but other than that I'm completely lost by your suggestions. Sorry I'm just so new to this.

I've gone through the instructions on the phpBB site but can't find anything that discusses configuring php for email.

jatar_k

10:22 pm on May 11, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



try doing this

put this in a file, upload it to the server, then call it in your browser

<? 
$diditgo = mail("you@yourdomain.com","my mailtest","my mailtest");
if (!$diditgo) echo "failed";
else echo "success";
?>

replace you@yourdomain.com with your email address and see if it sends you an email

jetnovo

11:11 pm on May 11, 2004 (gmt 0)

10+ Year Member



Thanks so much for your continued help.

I tried that and it worked. My browser displayed "Success" and I received the email.

What next? :)

jatar_k

11:45 pm on May 11, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



It would seem then that php is configured properly for mail but not phpbb

what are the lines before the

"message_die" on line 234

what exactly is causing it to die or what variable is it testing?

jetnovo

1:05 am on May 12, 2004 (gmt 0)

10+ Year Member



Here are lines #1 through to #234:

// Send message ... removed $this->encode() from subject for time being
if ( $this->use_smtp )
{
if (!defined('SMTP_INCLUDED') )
{
include($phpbb_root_path . 'includes/smtp.' . $phpEx);
}

$result = smtpmail($to, $this->subject, $this->msg, $this->extra_headers);
}
else
{
$empty_to_header = ($to == '')? TRUE : FALSE;
$to = ($to == '')? (($board_config['sendmail_fix'])? ' ' : 'Undisclosed-recipients:;') : $to;

$result = @mail($to, $this->subject, preg_replace("#(?<!\r)\n#s", "\n", $this->msg), $this->extra_headers);

if (!$result &&!$board_config['sendmail_fix'] && $empty_to_header)
{
$to = ' ';

$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '1'
WHERE config_name = 'sendmail_fix'";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Unable to update config table', '', __LINE__, __FILE__, $sql);
}

$board_config['sendmail_fix'] = 1;
$result = @mail($to, $this->subject, preg_replace("#(?<!\r)\n#s", "\n", $this->msg), $this->extra_headers);
}
}

// Did it work?
if (!$result)
{
message_die(GENERAL_ERROR, 'Failed sending email :: ' . (($this->use_smtp)? 'SMTP' : 'PHP') . ' :: ' . $result, '', __LINE__, __FILE__);

[edited by: jatar_k at 1:28 am (utc) on May 12, 2004]
[edit reason] edited code [/edit]

jatar_k

1:32 am on May 12, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I think those are the lines in question

I received some advice from one of the other mods who runs phpbb and she said to check the dead.letter file for clues and also

[phpbb.com...]
and
google search [google.com]

jetnovo

12:56 am on May 14, 2004 (gmt 0)

10+ Year Member



Interesting... I've tried a couple of suggestions without success but will review the thread more closely when I have time next week. Thanks!