Joke Collection Website - Blessing messages - Short message php source code
Short message php source code
If ($email_inc) returns;
$ email _ inc = " defined
define( "smtpport ",25);
Pop3 level 3 {
Var $ subject// email subject
Var $ from _ email// sender's address
Var $ from _ name// sender's name
Var $ to _ email// Address of the recipient
Var $ to _ name// Recipient's name
Var $ body// email content
Var $ filename// file name
Var $ socket// current socket
var $ line
Var $ status;
Function pop 3 _ open($ server, $ port)
{
$ this-& gt; socket = fsockopen($server,$ port);
If ($ this->; Socket < = 0) {
Returns false
}
$ this-& gt; line = fgets($ this-& gt; Socket,1024);
$ this-& gt; status[" last result "]= substr($ this-& gt; Line, 0,1);
$ this-& gt; status[" last result txt "]= substr($ this-& gt; Line 0,1024);
If ($ this->; Status ["lastresult"] < > "+") returns false.
Return true
}
Function pop3_user($user)
{
If ($ this->; Socket & lt0){
Returns false
}
fputs($ this-& gt; Socket, "user $ this->; usernn”);
$ this-& gt; line = fgets($ this-& gt; Socket,1024);
$ this-& gt; status[" last result "]= substr($ this-& gt; Line, 0,1);
$ this-& gt; status[" last result txt "]= substr($ this-& gt; Line 0,1024);
If ($ this->; Status ["lastresult"] < > "+") returns false.
Return true
}
Function pop3_pass( $pass)
{
fputs($ this-& gt; socket," pass $ passrn ");
$ this-& gt; line = fgets($ this-& gt; Socket,1024);
$ this-& gt; status[" last result "]= substr($ this-& gt; Line, 0,1);
$ this-& gt; status[" last result txt "]= substr($ this-& gt; Line 0,1024);
If ($ this->; Status ["lastresult"] < > "+") returns 0;
Returns1;
}
Function pop3_stat ()
{
fputs($ this-& gt; socket," statrn ");
$ this-& gt; line = fgets($ this-& gt; Socket,1024);
$ this-& gt; status[" last result "]= substr($ this-& gt; Line, 0,1);
$ this-& gt; status[" last result txt "]= substr($ this-& gt; Line 0,1024);
If ($ this->; Status ["lastresult"] < > "+") returns 0;
If (! eregi( "+ok(。 *) (.*)",$ this-& gt; Ok, $regs))
Returns 0;
return $ regs[ 1];
}
Function pop3_list ()
{
fputs($ this-& gt; socket,“listrn”);
$ this-& gt; line = fgets($ this-& gt; Socket,1024);
$ this-& gt; status[" last result "]= substr($ this-& gt; Line, 0,1);
$ this-& gt; status[" last result txt "]= substr($ this-& gt; Line 0,1024);
If ($ this->; Status ["lastresult"] < > "+") returns 0;
$ I = 0;
while(substr($ this-& gt; line = fgets($ this-& gt; socket, 1024),0, 1)& lt; & gt".")
{
$ articles[$ I]= $ this-& gt; Line;
$ i++;
}
$ articles[" count "]= $ I;
Return to $ articles
}
Function pop3_retr($nr)
{
fputs($ this-& gt; socket," retr $ nrrn ");
$ this-& gt; line = fgets($ this-& gt; Socket,1024);
$ this-& gt; status[" last result "]= substr($ this-& gt; Line, 0,1);
$ this-& gt; status[" last result txt "]= substr($ this-& gt; Line 0,1024);
If ($ this->; Status ["lastresult"] < > "+") returns 0;
while(substr($ this-& gt; line = fgets($ this-& gt; socket, 1024),0, 1)& lt; & gt".")
{
$ data[$ I]= $ this-& gt; Line;
$ i++;
}
$ data[" count "]= $ I;
Return to $ data
}
Function pop3_dele( $nr)
{
fputs($ this-& gt; socket," dele $ nrrn ");
$ this-& gt; line = fgets($ this-& gt; Socket,1024);
$ this-& gt; status[" last result "]= substr($ this-& gt; Line, 0,1);
$ this-& gt; status[" last result txt "]= substr($ this-& gt; Line 0,1024);
If ($ this->; Status ["lastresult"] < > "+") returns 0;
Returns1;
}
Function pop3_quit ()
{
fputs($ this-& gt; socket,“quitrn”);
$ this-& gt; line = fgets($ this-& gt; Socket,1024);
$ this-& gt; status[" last result "]= substr($ this-& gt; Line, 0,1);
$ this-& gt; status[" last result txt "]= substr($ this-& gt; Line 0,1024);
If ($ this->; Status ["lastresult"] < > "+") returns 0;
Returns1;
}
}
Smtp class {
Var $ subject// string email subject
Var $ fromname// string sender name (opt)
Var $ toname// string recipient name (opt)
Var $ body// String body copy
Var $ attachment; //Accessories (optional)
var $ attachmenttype
var $ socket
var $ line
Var $ status;
Function smtp($server = "localhost ",$port = smtpport)
{
return $ this-& gt; open($server,$ port);
}
Function smtpmail($fromemail, $fromname, $toemail, $toname, $subject, $body, $attachment=null, $attachmenttype= "text ").
{
$ this-& gt; subject = $ subject
$ this-& gt; toname = $ toname
$ this-& gt; fromname = $ fromname
$ this-& gt; body = $ body
$ this-& gt; Attachment = $ attachment;
$ this-& gt; attachment type = $ attachment type;
If ($ this->; helo() == false){
Returns false
}
If ($ this->; mailfrom($fromemail) == false){
Returns false
}
If ($ this->; rcptto($toemail) == false){
Returns false
}
If ($ this->; body() == false){
Returns false
}
If ($ this->; quit() == false){
Returns false
}
}
Function on ($ server, $ port)
{
$ this-& gt; socket = fsockopen($server,$ port);
If ($ this->; Socket & lt0) returned false.
$ this-& gt; line = fgets($ this-& gt; Socket,1024);
$ this-& gt; status[" last result "]= substr($ this-& gt; Line, 0,1);
$ this-& gt; status[" last result txt "]= substr($ this-& gt; Line 0,1024);
If ($ this->; Status ["lastresult"] < & gt" 2 ") returns false.
Return true
}
Function helo ()
{
if(fputs($ this-& gt; Socket, "Helorn") < 0 ){
Returns false
}
$ this-& gt; line = fgets($ this-& gt; Socket,1024);
$ this-& gt; status[" last result "]= substr($ this-& gt; Line, 0,1);
$ this-& gt; status[" last result txt "]= substr($ this-& gt; Line 0,1024);
If ($ this->; Status ["lastresult"] < & gt" 2 ") returns false.
Return true
}
Function ehlo ()
{
/* Well, we'll use "Shiloh" now ... until we need it.
Extra features [unknown]
*/
if(fputs($ this-& gt; socket," helo localhostrn ")& lt; 0){
Returns false
}
$ this-& gt; line = fgets($ this-& gt; Socket,1024);
$ this-& gt; status[" last result "]= substr($ this-& gt; Line, 0,1);
$ this-& gt; status[" last result txt "]= substr($ this-& gt; Line 0,1024);
If ($ this->; Status ["lastresult"] < & gt" 2 ") returns false.
Return true
}
Function mailfrom($fromemail)
{
if(fputs($ this-& gt; socket," mail from:& lt; $ fromemail & gtrn”)& lt; 0){
Returns false
}
$ this-& gt; line = fgets($ this-& gt; Socket,1024);
$ this-& gt; status[" last result "]= substr($ this-& gt; Line, 0,1);
$ this-& gt; status[" last result txt "]= substr($ this-& gt; Line 0,1024);
If ($ this->; Status ["lastresult"] < & gt" 2 ") returns false.
Return true
}
Function rcptto($toemail)
{
if(fputs($ this-& gt; Socket, "rcpt to: <; $ toemail & gtrn”)& lt; 0){
Returns false
}
$ this-& gt; line = fgets($ this-& gt; Socket,1024);
$ this-& gt; status[" last result "]= substr($ this-& gt; Line, 0,1);
$ this-& gt; status[" last result txt "]= substr($ this-& gt; Line 0,1024);
If ($ this->; Status ["lastresult"] < & gt" 2 ") returns false.
Return true
}
Function body ()
{
$ filesize = 0;
$ attachment = null
$ fp = null
$ buffer = sprintf(" from:% srn to:% srn subject:% srn ",$ this-& gt; fromname,$ this-& gt; toname,$ this-& gt; Theme);
if(fputs($ this-& gt; socket," datarn ")& lt; 0){
Returns false
}
$ this-& gt; line = fgets($ this-& gt; Socket,1024);
$ this-& gt; status[" last result "]= substr($ this-& gt; Line, 0,1);
$ this-& gt; status[" last result txt "]= substr($ this-& gt; Line 0,1024);
If ($ this->; Status ["lastresult"] < & gt" 3 ") returns false.
if(fputs($ this-& gt; socket,$ buffer)& lt; 0){
Returns false
}
If ($ this->; Attachment = = empty) {
if(fputs($ this-& gt; socket," mime-version: 1.0 rn content-type:text/plain; charset = iso-8859- 1rn content-transfer-encoding:7 bitrnrn ")& lt; 0){
Returns false
}
if(fputs($ this-& gt; Socket, "$ this-& gt;; body rnrn ")& lt; 0){
Returns false
}
if(fputs($ this-& gt; Socket, ". rn”)& lt; 0){
Returns false
}
- Previous article:How to buy smart watch products?
- Next article:Xi an kang Qin registration form SMS
- Related articles
- How to write the power of attorney for vaccination
- What are the company's New Year greetings to customers?
- Can imessage set the chat background?
- Huawei Glory 6 Configuration
- Is it true that the supervisor went home today?
- I broke up with my boyfriend and sent a message on WeChat. He saw it, but didn't reply to me. What does this mean?
- Who will Taobao refund SMS be sent to?
- What is the flashback of Xiaomi's mobile phone?
- The online loan is connected, the bank card number is wrong, and the funds are frozen. What is the matter? Entry of
- What message should I send to the girl I like (not yet my girlfriend) on Valentine's Day?