<?php

    require_once 'PHPMailer/PHPMailerAutoload.php';

	$mail = new PHPMailer;

	$from     = "dsa@internetofhomethings.com";
	$fromname = "Dave";
	$email    = "surfnturf57@yahoo.com";
	$name     = "Dagger";
	$sbj      = "Test Message";
	$msg      = "Hi folks";

    /***
	$mail->IsSMTP();
	$mail->Host = "smtp.internetofhomethings.com";
    $mail->SMTPAuth = false;
    ***/
    $mail->IsMAIL();

	//----------------------- Basic email headers -----------------------
	$mail->setFrom($from, $fromname,0);     //Set who the message is to be sent from
	$mail->addReplyTo($from, 'No Reply'); //Set an alternative reply-to address
	$mail->addAddress($email, $name);     //Set who the message is to be sent to
	//$mail->addAddress($email);            //Set who the message is to be sent to
	$mail->Subject = $sbj;                //Set the subject line
	$mail->msgHTML($msg);                 //Set Message
	//$mail->AltBody = $msg;              //Replace the plain text body with one created manually
/**
	//------------------ Set domain specific parameters -----------------
	$mail->DKIM_domain     = 'samo-mvp.org';
	$mail->DKIM_private    = 'PHPMailer/dkim_privatekey.mvp';
	$mail->DKIM_selector   = 'mvp';
	$mail->DKIM_passphrase = '';
	$mail->DKIM_identity   = $mail->From;
**/
	//----------------------- Custom email headers -----------------------
	$mail->ClearCustomHeaders();
	$authas                        = $fromname."@".$_SERVER['SERVER_NAME'];
	$mail->addCustomHeader("X-Authenticated-As:".$authas);
	$mail->addCustomHeader("X-Mailer:"."PHP/" . phpversion());
	$mail->addCustomHeader("MIME-Version:"."1.0");
	$mail->addCustomHeader("Content-type:"."text/html; charset=UTF-8");

	//send the message, check for errors
	if (!$mail->send()) {
		echo "Mailer Error: " . $mail->ErrorInfo."<br>";
		//return 0;
	} else {
		echo "Message sent!<br>";
		//return 1;
	}


echo "end of script<br>";




	/************************************************************************/

   echo ini_get('SMTP') . ":" . ini_get('smtp_port')."<br>";

	echo "Ready to set headers...<br>";
	$headers  = "From: "."root@internetofhomethings.com"."\r\n";
	$headers .= "Reply-To: ".'No Reply'." <".''.">\r\n";
	$headers .= "X-Authenticated-As: "."root@internetofhomethings.com\r\n";
	$headers .= "X-Mailer: PHP/" . phpversion()."\r\n";
	$headers .= "MIME-Version: 1.0" . "\r\n";
	$headers .= "Content-type: text/html; charset=UTF-8\r\n";

	echo "Ready to send email...<br>";
	if( mail("surfnturf57@yahoo.com", "Did you get this? via php mail()", "Nice Day!", $headers, "root@internetofhomethings.com") )
	{
		echo "Mail sent<br>";
	}
	else
	{
		echo "Mail failed!<br>";
	}

	/*************************************************************************/


    //echo "Mail:".(((mail("surfnturf57@yahoo.com","Testing php -v ".phpversion(),"php on ".gethostname()))=='0') ? "FAIL":"PASS")."<br>";
?>