Thread: Mail function..
View Single Post
Old 05-05-2008, 01:53 PM   #1 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default Mail function..

Hi!

I'm having some trouble with my mail function.
Or well.. erh.. just look

php Code:
/**
        * @ Sends an activation email to the newly registered user
        *
        * @ Returns true or false
        **/

        private function sendActMail() {
           
            $sql = sprintf("    SELECT
                                    *
                                FROM
                                    `%s`"
,
                                   
                                $this->db->table['config']);
                               
            $query = $this->db->query($sql) or die(mysql_error());
            if($query) {
               
                $config = $this->db->fetch($query);
               
                $to = $this->reg_userinfo['email'];
                $subject = $config['actMail_subject'];
               
                    $subjectdata = array(
                   
                        'username' => $this->reg_userinfo['uname'],
                        'website' => $config['website_name']
                   
                    );
                   
                    $subject = $this->tpl->getParsed($subjectdata, $subject);
               
               
                $message = $config['actMail_message'];
               
                    $messagedata = array(
                   
                        'username' => $this->reg_userinfo['uname'],
                        'password' => $this->reg_userinfo['pword'],
                        'activationcode' => $this->reg_userinfo['actCode'],
                        'email' => $config['website_email'],
                   
                    );
                   
                    $message = $this->tpl->getParsed($messagedata, $message);
                   
                $headers = 'From: ' . $config['website_email'];
               
                $mail = mail($to, $subject, $message, $headers);
               
                if($mail) {
                   
                    return true;
                   
                }
               
                return false;
               
            }
           
            return false;
           
        }

gives me this..

Code:
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\..user.php on line 358
I know this means that you can't send a mail from localhost..
but does the email function work other than that? Cause I can't test it.. since I don't have an smtp server..
__________________
Tanax is offline  
Reply With Quote