Joke Collection Website - Blessing messages - Ask for PHP code to receive form content and send emails
Ask for PHP code to receive form content and send emails
Requires Jmail component support
lt;?
class Jmail
{
public $Username; / /Post office username
public $Password; //Password
public $FormName; //Sender’s name
public $From; //Send mail Person's address
public $Addrecipient; //Recipient's address
public $Ttile; //Email title
public $Content; //Email content
public $Smtp; //Mail server
function Send(){
$Jmail = new com("Jmail.Message"); //Instantiation A Jmail object
$Jmail-gt; SiLent=true; //If set to True, Jmail will not prompt an error and will only return True and False
$Jmail-gt; LogGing = false; //Whether to enable logging
$Jmail-gt; CharSet = "GB2312"; //Set string encoding
$Jmail-gt; ContentType = "Text/html "; //The format of the email is HTML format
$Jmail-gt;MailServerUsername = $this-gt;Username; //The user name of the sending mailbox
$Jmail-gt;MailServerPassword = $this-gt; Password; //Password for sending mailbox
$Jmail-gt; FromName = $this-gt; FromName; //Sender’s name
$Jmail- gt;From = $this-gt;From; //Sender's address
$Jmail-gt;AddRecipient($this-gt;Addrecipient); //Recipient's address
$Jmail-gt;Subject = $this-gt;Title; //Email title
$Jmail-gt;Body = $this-gt;Content; //Email text
$JmailError = $Jmail-gt; Send($this-gt; Smtp); //Smtp server
if($JmailError){ //Determine whether the email is sent successfully
return true;
}else{
return false;
}
}
} p>
//Here is the calling code
$jmail = new Jmail();
$jmail-gt; Username = "lwf0757";
$jmail-gt;Password = "0757";
$jmail-gt;FromName = "Liang";
$jmail-gt;From = "lwf0757@163.com ";
$jma
il-gt;Addrecipient = "313120799@qq.com";
$jmail-gt;Title = "This is the title";
$jmail-gt;Content = $_POST ["contact_message"]; //"This is the content";
$jmail-gt; Smtp = "smtp.163.com";
if($jmail-gt; Send()){
echo "Success!";
}else{
echo "Failure!";
} gt;
- Related articles
- Why can't I get text messages on my iphone? ?
- The hit Thai drama "I want to be a superstar"
- Accidentally sent a text message to cancel the telecom traffic package. How to recover traffic packets?
- A poetic copy of confession
- Short Mid-Autumn Festival blessings for the elderly
- Can I return the cancellation number of Unicom mobile phone card?
- What mobile phone card is cheaper to send text messages in Chongqing?
- Funny text message thanking my boyfriend for cooking breakfast for me
- Will there be photos in the text message without a seat belt in 2022?
- Blessings for Xiaoshu solar terms