<?php

$smtp_server 
"mail.mymailserver.com";
$mydomain "any_text_here";


//get the following info from your mail server eg. au.yahoo.com

$port 25//SMTP PORT of mail.mymailserver.com
$username "myusername"$password "mymail_password";


$sender "myusername@mymailserver.com";

/*
Most respectable mail servers will reject outgoing mail
if $sender e-mail address does not belong to $username
*/

$sender_name "My Name"//Any name you fancy


$recipient "your.friend@someother.com";
$subject "the subject";
$content "the message";

// SMTP connection

$handle fsockopen($smtp_server,$port);
fputs($handle"EHLO $mydomain\r\n");

// SMTP authorization
fputs($handle"AUTH LOGIN\r\n");
fputs($handlebase64_encode($username)."\r\n");
fputs($handlebase64_encode($password)."\r\n");

// Send out the e-mail
fputs($handle"MAIL FROM:$sender\r\n");
fputs($handle"RCPT TO:$recipient\r\n");
fputs($handle"DATA\r\n");
fputs($handle"From: $sender_name<$sender>\r\n");

//you can use different e-maill address in above line, but most spam blockers will suspect this

fputs($handle"To: $recipient\r\n");
fputs($handle"Subject: $subject\r\n");
fputs($handle"$content\r\n");
fputs($handle".\r\n");

//Don't ignore the period "." in line above. This indicates the end of your mail

// Close connection to SMTP server
fputs($handle"QUIT\r\n");
?>