because PHP does not provide out-of-the-box SMTP functions, it provides a less flexible mail () function that requires support on the server configuration and does not support SMTP authentication, and is not recommended for use in many situations. The purpose of this article is to specify the direction for the novice, and did not involve those advanced content, a limited level of their own, and also worry about not accurate to tell the relevant concepts, and thus mislead you, but also to learn their own in-depth.
"Use PHP to send mail" has recently become a "register_globals" after the second novice trap, today specially write this article for novice FAQ, hoping to be confused for the direction of the people.
let's start with the following example:
Reference:
[root@server~/]# telnet localhost 25
Trying 127.0.0.1 ...
Connected to localhost.
Escape character is ' ^] '.
server.domain.com.br ESMTP Postfix (2.1.0)
MAIL from:teste@dominio.com.br
Ok
RCPT to:teste@dominio.com.br
Ok
DATA
354 End data with <CR><LF>.<CR><LF>
Teste
.
Ok:queued as 7b41f4665a
QUIT
221 Bye
Connection closed by foreign host.
Note: The above from netkiller postfix documents, lazy, directly with ready-made.
The first is to use Telnet to connect to local port 25, and people who are slightly familiar with the DOT network know that the SMTP protocol uses port 25, which means that it is now connected to the local SMTP server.
Reference:
Trying 127.0.0.1 ...
Connected to localhost.
Escape character is ' ^] '.
server.domain.com.br ESMTP Postfix (2.1.0)
These things are system output information that is already connected, and this SMTP server is postfix.
The "MAIL from:teste@dominio.com.br" command indicates that the address is teste@dominio.com.br, "OK" indicates that the command was accepted and properly executed by the server, similar to the HTTP protocol 200, 404, 500 and so on status code. The next "RCPT to:teste@dominio.com.br" indicates that the recipient address is teste@dominio.com.br.
Reference:
DATA
354 End data with <CR><LF>.<CR><LF>
Teste
.
This paragraph is the input message body, enter "DATA" after the system prompts to use "< return >.< return >" To end the input, the body content is "teste".
Finally, use "QUIT" to exit.
Note: The above from netkiller postfix documents, lazy, directly with ready-made.
The first is to use Telnet to connect to local port 25, and people who are slightly familiar with the DOT network know that the SMTP protocol uses port 25, which means that it is now connected to the local SMTP server.
Reference:
Trying 127.0.0.1 ...
Connected to localhost.
Escape character is ' ^] '.
server.domain.com.br ESMTP Postfix (2.1.0)
These things are system output information that is already connected, and this SMTP server is postfix.
The "MAIL from:teste@dominio.com.br" command indicates that the address is teste@dominio.com.br, "OK" indicates that the command was accepted and properly executed by the server, similar to the HTTP protocol 200, 404, 500 and so on status code. The next "RCPT to:teste@dominio.com.br" indicates that the recipient address is teste@dominio.com.br.
Reference:
DATA
354 End data with <CR><LF>.<CR><LF>
Teste
.
This paragraph is the input message body, enter "DATA" after the system prompts to use "< return >.< return >" To end the input, the body content is "teste".
Finally, use "QUIT" to exit.
Note: The above from netkiller postfix documents, lazy, directly with ready-made.
The first is to use Telnet to connect to local port 25, and people who are slightly familiar with the DOT network know that the SMTP protocol uses port 25, which means that it is now connected to the local SMTP server.
Reference:
Trying 127.0.0.1 ...
Connected to localhost.
Escape character is ' ^] '.
server.domain.com.br ESMTP Postfix (2.1.0)
These things are system output information that is already connected, and this SMTP server is postfix.
The "MAIL from:teste@dominio.com.br" command indicates that the address is teste@dominio.com.br, "OK" indicates that the command was accepted and properly executed by the server, similar to the HTTP protocol 200, 404, 500 and so on status code. The next "RCPT to:teste@dominio.com.br" indicates that the recipient address is teste@dominio.com.br.
Reference:
DATA
354 End data with <CR><LF>.<CR><LF>
Teste
.
This paragraph is the input message body, enter "DATA" after the system prompts to use "< return >.< return >" To end the input, the body content is "teste".
Finally, use "QUIT" to exit.
Total 2 page: previous 1 [2] Next page