NineChime forum

Furry stuff, oekaki stuff, and other stuff.

You are not logged in.

#1 07-17-2008 15:57:30

twirp
New member

SMTP Auth for Mail

If you can't use mail() or mail() is disabled on the server you're hosted on, and assuming that Pear::Mail is installed (or that you've installed it yourself), this fix might help your installation of Wacintaki actually send out e-mails <(O.o)>

Basically open up common.php (not functions.php, odd in my opinion as all the functions are in common.php and all of the common needs are in functions.php...)

Anywho, open up common.php in your favorite text editor and click on find and look for w_mail  Once you're wear the function is declared, replace it with the following changing it to follow your information.

Code:

function w_mail ($email, $subject, $message) {
    global $cfg;
    
    require_once "Mail.php";
    
    $headers = array ('From' => "OekakiPoteto <{$cfg['op_email']}>",
    'To' => "User <" . $email . ">",
    'Subject' => $subject);
    
    // Change to fit you server's settings.
    $smtp = Mail::factory('smtp',
    array ('host' => "smtp.somehost.com",
    'auth' => true,
    'port' => 25,
    'username' => "smtpUser",
    'password' => "smtpPass"));

    $mail = $smtp->send($email, $headers, $message);
    
    if (DISABLE_EMAIL_CONFIRMATION == 1) {
        return (TRUE);
    }
    return !(PEAR::isError($mail));
}

It works for me, so hopefully it can work for you, but you need Pear::Mail installed.  And if you host doesn't provide mail() or an SMTP server, you could always try using GMail's SMTP server...?
http://lifehacker.com/software/email-ap … 111166.php
http://www.geekzone.co.nz/tonyhughes/599

Last edited by twirp (07-17-2008 15:57:59)


If one isn't fully appreciated till death,
Then why do I keep on living?

Offline

#2 07-18-2008 01:31:10

Waccoon
Administrator

Re: SMTP Auth for Mail

This is good to know, simply to offer an alternative.

The problem is that if a host has disabled PHP's built-in mail() function, it's probably due to the host's security/spam policy, and PEAR::Mail isn't likely to be enabled, either.  Also, since Wacintaki is designed for virtual hosts and not dedicated hosting, I can't rely on any PEAR modules being available.  My web site is based on paid virtual hosting, and doesn't have PEAR, which is annoying.

Offline

#3 07-18-2008 10:34:51

twirp
New member

Re: SMTP Auth for Mail

Waccoon wrote:

This is good to know, simply to offer an alternative.

The problem is that if a host has disabled PHP's built-in mail() function, it's probably due to the host's security/spam policy, and PEAR::Mail isn't likely to be enabled, either.  Also, since Wacintaki is designed for virtual hosts and not dedicated hosting, I can't rely on any PEAR modules being available.  My web site is based on paid virtual hosting, and doesn't have PEAR, which is annoying.

The place where I'm hosted wants all e-mails sent through a authenticated SMTP session (I guess to prevent spam and be able to tell who's doing it).  Can't you install Pear in a Shared hosting environment (somewhere under your domain)?  I know that it's more painful to do, but I've read it can be done.

If PEAR::Mail isn't enabled, there's a bunch of other options like phpMailer.


If one isn't fully appreciated till death,
Then why do I keep on living?

Offline

#4 07-19-2008 01:33:30

Waccoon
Administrator

Re: SMTP Auth for Mail

PEAR is actually an installer, so if PEAR is installed, you can then download PEAR packages.  If PEAR is not installed, you have to ask your sysadmin to install it, because it must go into the PHP folder, and only an authorized login can do that.  Even if PEAR is available, packages can only be installed through the command line, so you must have a shell login.  Many shared hosts do not allow that.

If PEAR::Mail isn't enabled, there's a bunch of other options like phpMailer.

Yeah, SMTP support just involves connecting to the right server port.  There's really nothing special that has to be installed on your server to do that.  I've noticed that PunBB, the forum you're looking at now, has a custom mailing system that does not rely exclusively on the mail() function.

Offline

Board footer

Yep, still running PunBB
© Copyright 2002–2008 PunBB