Here is the use of GoDaddy Linux host, Windows host should also be similar, I did not try.
The first way to send mail using PHP's own mail () function
File organization, put 123.html and send.php two files in the same directory
123.html
send.php
$to = "lasercoder@foxmail.com";
$subject = "Subject";
$message = "hello!". $_post["name"]. ", this is a simple email message.";
$from = "coder";
$headers = "From: $from";
if (Mail ($to, $subject, $message, $headers))
echo "Mail sent.";
else echo "Mail fail.";
?>
the second approach, using the Phpmailer open source class
File organization, put 123.html and send.php in the same directory, download Phpmailer and name the Phpmailer folder, and put it in the same directory.
GoDaddy gift Enterprise Mailbox, in the Control Panel to add an email account, easy to complete the following SMTP mailbox account and password.
123.html
send.php
Header (' content-type:text/html; Charset=utf-8 ');
Require "phpmailer/class.phpmailer.php";
$mail = new Phpmailer;
$mail->issmtp (); Set up mail using SMTP
$mail->host = ' mail.site.com '; Mail server address
$mail->smtpauth = true; Enable SMTP authentication
$mail->charset = "UTF-8"; Set up message encoding
$mail->setlanguage (' zh_cn '); Set Error Chinese Tips
$mail->username = ' admin@site.com '; SMTP user name, which is the personal email address
$mail->password = ' 123456 '; SMTP password, which is the personal mailbox password
$mail->smtpsecure = ' TLS '; Set enable encryption, note: The Php_openssl module must be turned on
$mail->priority = 3; Set message Priority 1: High, 3: normal (Default), 5: Low
$mail->from = ' someone@someone.com '; Sender e-mail address
$mail->fromname = ' sender's name '; Sender Name
$mail->addaddress (' lasercoder@foxmail.com '); Add recipient
$mail->confirmreadingto = ' someone@someone.com '; Add a Send receipt e-mail address, that is, when the recipient opens the message, asks if receipts have occurred
$mail->addbcc (' someone@someone.com '); Add encrypted send, Mail header will not display the secret send the person information
$mail->wordwrap = 50; Set 50 characters for line wrapping
$mail->addattachment ('/tmp/image.jpg ', ' one pic '); Add multiple Attachments
$mail->ishtml (TRUE); Set the message format to HTML
$mail->subject = ' Here is the theme ';
$mail->body = ' This is the HTML information Body
In bold!. Time: ';
$mail->altbody = ' This is the principal in plain text for non-html mail clients ';
if (! $mail->send ()) {
Echo ' Message could not being sent. ';
Echo ' Mailer Error: '. $mail->errorinfo;
Exit
}
Echo ' Message has been sent ';
?>