Location: PHPKode > scripts > txtSQL MailBox > txtsql-mailbox/nlmail.php
<?
 /*************************************************************************/
 # txtSQL MailBox 0.1 by Nexami Engeo (http://www.n-e-x.co.uk)     #
 # txtSQL MailBox is based on phpMailBox 1.1     #
 # Lasy Modified : 5th April, 2005  22:50 GMT     #
 # txtSQL MailBox 0.1 is Copyright (C) by John Urquhart Ferguson     #
 # All previous licensing applies     #
 #
 # More information on the txtSQL project can be found at: http://txtsql.sourceforge.net)
 #
 #  phpMailbox 1.1   by Sivaprasad R.L (http://netlogger.net/phpmailbox)  #
 #                                                                        #
 #          --  A php pop3 client --              			  #
 #                                                                        #
 # This program is distributed in the hope that it will be useful,        #
 # but WITHOUT ANY WARRANTY; without even the implied warranty of         #
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          #
 # GNU General Public License for more details.                           #
 #                                                                        #
 # You should have received a copy of the GNU General Public License      #
 # along with this program; if not, write to the Free Software            #
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.              #
 #                                                                        #
 #             phpMailBox 1.1 is Copyright (C) by Sivaprasad R.L                            #
 #                                                                        #
/*************************************************************************/

    include "mailheader.php";
    require_once "emailconfig.php";

    session_start();

    global $uid,$domain, $footermsgtxt, $attachmentdir, $fromemail;
    include "mail.inc";
	
 
    srand ((double) microtime() * 1000000);
    $messageid = rand();

	//New txtSQL code
    $res = $sql->query('SELECT * FROM popsettings
                        WHERE uid = '.$uid.' AND fromemail = "'.$fromemail.'"
		                ');
    $row = $res[0];
	
	//Old MySQL code
    //$sql = "SELECT * FROM popsettings WHERE uid = '$uid' and fromemail = '$fromemail'";
    //$resultID = mysql_query($sql);

    //$myrow = mysql_fetch_array($resultID);
	
    //$email = $myrow[fromemail];
    //$name = $myrow[fromname];
    //$user = $myrow[uname];
    $email = $row["fromemail"];
    $name = $row["fromname"];
    $user = $row["uname"];
    if($name == "") $name = $user;
    if($email == "") $email = $user."@".$domain;
    $from = $name . "<".$email.">";

    global $contenttype;
    global $attachment, $attchtype;
    $txtfooter = "\n\n______________________________________________________________\n";
    $txtfooter .= "$footermsgtxt";
    $message = stripslashes($message);
    $content = $message.$txtfooter;
    $contenttype = "text/plain";
    $acknowledge = "N";
    $status = "NONE";

    if($attachment != "") $attachment = $attachmentdir.$attachment;

    $m= new Mail;
    $m->autoCheck(false);
    $m->From($from);
    $m->To($to);
    $m->Subject($subject);

    $m->Body($content,"us-ascii");
    $m->Cc($cc);
    $m->Bcc($bcc);
    $m->Priority($prior) ;
    if($attachment != "")  $m->Attach($attachment,$attchtype);
    $m->Send();

    if($attachment != "")
        @unlink($attachment);

    echo "<br><br<br><center><b class=\"font1\">Your message has been sent.</b></center><br><br> ";
    include "mailfooter.php";
?>
Return current item: txtSQL MailBox