Topic: smtp server port?

My smtp server uses a non standard port, when I try to tell PunBB to use say smtp.something.com:2500 it doesn't accept it... is there a way around this?

Re: smtp server port?

I'll look into this.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: smtp server port?

This is fixed in version 1.1 of punbb. If you want to use it in 1.0.1, you can just open up include/email.php and replace the funktion smtp_email() with the following:

function smtp_mail($to, $subject, $message, $headers = '')
{
    global $options;

    $recipients = explode(',', $to);

    // Are we using port 25 or a custom port?
    if (strpos($options['smtp_host'], ':') !== false)
        list($smtp_host, $smtp_port) = explode(':', $options['smtp_host']);
    else
    {
        $smtp_host = $options['smtp_host'];
        $smtp_port = 25;
    }

    if (!($socket = fsockopen($smtp_host, $smtp_port, $errno, $errstr, 15)))
        error('Could not connect to smtp host "'.$options['smtp_host'].'" ('.$errno.') ('.$errstr.')', __FILE__, __LINE__);

    server_parse($socket, '220');

    if ($options['smtp_user'] != '' && $options['smtp_pass'] != '')
    {
        fwrite($socket, 'EHLO '.$smtp_host."\r\n");
        server_parse($socket, '250');

        fwrite($socket, 'AUTH LOGIN'."\r\n");
        server_parse($socket, '334');

        fwrite($socket, base64_encode($options['smtp_user'])."\r\n");
        server_parse($socket, '334');

        fwrite($socket, base64_encode($options['smtp_pass'])."\r\n");
        server_parse($socket, '235');
    }
    else
    {
        fwrite($socket, 'HELO '.$smtp_host."\r\n");
        server_parse($socket, '250');
    }

    fwrite($socket, 'MAIL FROM: <'.$options['webmaster_email'].'>'."\r\n");
    server_parse($socket, '250');

    $to_header = 'To: ';

    @reset($recipients);
    while (list(, $email) = @each($recipients))
    {
        fwrite($socket, 'RCPT TO: <'.$email.'>'."\r\n");
        server_parse($socket, '250');

        $to_header .= '<'.$email.'>, ';
    }

    fwrite($socket, 'DATA'."\r\n");
    server_parse($socket, '354');

    fwrite($socket, 'Subject: '.$subject."\r\n".$to_header."\r\n".$headers."\r\n\r\n".$message."\r\n");

    fwrite($socket, '.'."\r\n");
    server_parse($socket, '250');

    fwrite($socket, 'QUIT'."\r\n");
    fclose($socket);

    return true;
}
"Programming is like sex: one mistake and you have to support it for the rest of your life."