PHP, smtp auth, load error

Posted on 2009-04-26
Last Modified: 2013-12-12

I am not sure what I am doing wrong but this is my error:

Fatal error: Call to undefined function authSendEmail() in /var/www/vhosts/ on line 154

LINE 154 = authSendEmail($from, $namefrom, $to, $nameto, $subject, $message);

$userid = mysql_insert_id();

/* * * * * * * * * * * * * * SEND EMAIL FUNCTIONS * * * * * * * * * * * * * */


//Authenticate Send - 21st March 2005

//This will send an email using auth smtp and output a log array

//logArray - connection,

$nameto = "Who To";

$to = $emailA;

$subject = " - User Varification";

$message = "

Dear $first_name $last_name,


Thank you for registering!


You are two steps away from joining


To activate your membership,

please click here:$userid&code=$db_password


Once you activate your membership, you will be able to login with the following information:


User name: $username

Password: $random_password


Thank you, Staff


This is an automated response, please do not reply!"; 

$from = "";

authSendEmail($from, $namefrom, $to, $nameto, $subject, $message);



function authSendEmail($from, $namefrom, $to, $nameto, $subject, $message)



/* * * * CONFIGURATION START * * * */

$smtpServer = "";

$port = "25";

$timeout = "30";

$username = "";

$password = "dd";

$localhost = "localhost";

$newLine = "\r\n";

/* * * * CONFIGURATION END * * * * */


//Connect to the host on the specified port

$smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout);

$smtpResponse = fgets($smtpConnect, 515);



$output = "Failed to connect: $smtpResponse";

return $output;




$logArray['connection'] = "Connected: $smtpResponse";


Open in new window

Question by:movieprodw
    LVL 4

    Expert Comment

    Looks like youre missing a closing } on your function - surprised it isn't throwing a Parse error though
    LVL 1

    Author Comment

    I do have it there I just cut the bottom chunk off the script it just has the redirects
    LVL 4

    Accepted Solution

    I tried running your code (with the } added) and I didn't get that error.  I think the problem must lie somewhere in the code you have not posted - perhaps a weird parse error in an include file that's preventing the function being read.
    LVL 1

    Author Comment

    Hu, ok I will look into it, thanks,

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now