The mail function is disabled in the BAE environment. To send emails, you can use the smtp method to send the following reference content: 1BAE uses socket series functions to send emails through the smtp protocol. 2 PHPSOCKET () sends emails 3PHPMailer, 1. Mail can be sent, but it is too simple. The most basic mail communication content, without the recipient and title, content 2 and 3 is always discounted.
The mail function is disabled in the BAE environment. You can use smtp to send emails as a reference. 1. Use socket functions in BAE to send emails through smtp protocol. 2. php socket () method to send mail 3 PHPMailer where, 1 can send mail, but it is too simple, the most basic mail communication content, no recipient and title, content 2 and 3 Total discount
The mail function is disabled in the BAE environment. You can send emails through smtp.
Refer to the following content:
1. Use socket series functions in BAE to send emails through smtp protocol
2. send an email using php socket ()
3 PHPMailer
Among them, 1 can send mail, but it is too simple, the most basic mail communication content, no recipient, title, content
2 and 3 won't make any effort.
Modify the Code 1 to add the following content:
$ Server = "smtp.163.com ";
$ Port = 25; // The default value is 25.
$ Username = "YOURNAME@163.com ";
$ Password = "YOURPASSWORD"; // password
$ Sendto = "TOWHO@gmail.com"; // email recipient address
$ Subject = "test title2 ";
$ Content = "test content2 ";
$ Header = "MIME-Version: 1.0 \ r \ n ";
$ Header. = "To:". $ sendto. "\ r \ n ";
$ Header. = "From: $ username <$ username> \ r \ n ";
$ Header. = "Subject:". $ subject. "\ r \ n ";
$ Data = $ header. "\ r \ n". $ content; // email content
$ Sock = socket_create (AF_INET, SOCK_STREAM, SOL_TCP );
If (socket_connect ($ sock, $ server, $ port) === false) socket_strerror (socket_last_error ());
Echo fig ($ sock, 100 )."";
Socket_write ($ sock, "HELO lyz810 \ r \ n ");
Echo fig ($ sock, 100 )."";
Socket_write ($ sock, "auth login \ r \ n ");
Echo fig ($ sock, 100 )."";
Socket_write ($ sock, base64_encode ($ username). "\ r \ n ");
Echo fig ($ sock, 100 )."";
Socket_write ($ sock, base64_encode ($ password). "\ r \ n ");
Echo fig ($ sock, 100 )."";
Socket_write ($ sock, "mail from: <". $ username. "> \ r \ n ");
Echo fig ($ sock, 100 )."";
Socket_write ($ sock, "rcpt to: <". $ sendto. "> \ r \ n ");
Echo fig ($ sock, 100 )."";
Socket_write ($ sock, "DATA \ r \ n ");
Echo fig ($ sock, 100 )."";
Socket_write ($ sock, $ data. "\ r \ n. \ r \ n ");
Socket_write ($ sock, "QUIT ");
Echo fig ($ sock, 100 )."";
Original article address: send an email in the BAE environment. Thank you for sharing your email.