Send email source (support ESTMP protocol, hypertext email format)

zhaozj2021-02-11  188

I often see how netizens will ask for email (SMTP server authentication) in the forum (SMTP server authentication), but only know if the client and mail server session, the username and password are transmitted after the Base64 encoded encryption, the problem is easily resolved. Protocol use The use of the SMTP protocol is exactly the same. It is worth noting that the ESMTP protocol is verified by the username and password verification. The server returns a 354 message code. This code has not been processed for the error prompt information, but guarantees that you can send mail properly. This code also uses IME encoding so you can send hypertext email. Foxmail4.1 Friends should know that it implemented the picture and the sound email is a highlight. This code can also implement hyper text messages, to send MID as a message as a background sound, as long as you want to modify the IME code section, you can implement it, and the song must be encoded with Base64.

At present, the principle of popular mail viruses is, through the vulnerability of IE in IME, the solution can delete the IME encoding format in the registry, or install Winamp can also solve it (need to do as long as the file format supported by Winamp) All choice, how to talk about it, you don't throw odor eggs to me, hehe, I don't have much nonsense, and there are all codes of the software. All code can also download on my personal home page. Welcome VB hobbies to contact me, exchange programming technology. Home: http://www.dapha.netmsn: dapha@msn.comversion 5.00 Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D} # 1.0 # 0"; "MSWINSCK.OCX" Begin VB.Form Form1 BorderStyle = 1 'Fixed Single Caption = "e-mail program (authentication server support smtp)" ClientHeight = 5550 ClientLeft = 45 ClientTop = 330 ClientWidth = 5805 LinkTopic = "Form1" MaxButton = 0' false ScaleHeight = 5550 ScaleWidth = 5805 StartUpPosition = 3 'Windows Default Begin MSWinsockLib.Winsock Winsock1 Left 2640 Top = 2520 _ExtentX = 741 _ExtentY = 741 End Begin VB.TextBox txtmessage1 Height = 1695 Left = 0 MultiLine = -1 =' True TabIndex = 16 Tooltiptext = "Here hypertext content of the letter" Top = 3480 Width = 5775 End Begin VB.TextBox user Height = 270 Left = 3960 TabIndex = 15 Top = 840 Width = 1575 End Begin VB.TextBox subject Height = 270 Left = 960 TabIndex = 12 text = "Hello" TOP = 1320 width =

2295 End Begin VB.TextBox txtserver Height = 270 Left = 960 TabIndex = 9 Text = "smtp.21cn.com" Top = 960 Width = 2295 End Begin VB.TextBox txtpwa Height = 270 IMEMode = 3 'DISABLE Left = 3960 MaxLength = 8 PasswordChar = "*" TabIndex = 7 Top = 1200 Width = 1575 End Begin VB.TextBox getaddress Height = 300 Left = 960 TabIndex = 5 Top = 600 Width = 2295 End Begin VB.TextBox txtfrom Height = 300 Left = 960 TabIndex = 3 TOP = 240 width = 2295 End begin vb.commandbutton cmdexit caption = "Exit" Height = 375 Left = 4680 Tabindex = 2 Top = 240 Width = 975 End Begin VB.CommandButton CmdSend Caption = "Send" Height = 375 Left = 3360 TabIndex = 1 Top = 240 Width = 975 End Begin VB.TextBox txtMessage Height = 1815 Left = 0 MultiLine = -1 'True TabINDEX = 0 Tooltiptext = "Letter Content" TOP = 1680 Width =

5775 End Begin VB.Label Label6 AutoSize = 'True Caption = "User Name" Height = 180 Left = 3360 TabIndex = 14 Top = 840 Width = 540 End Begin VB.Label StatusTxt AutoSize = -1' -1 True BackStyle = 0 ' Transparent BorderStyle = 1 'Fixed Single Height = 285 Left = 960 TabIndex = 13 Top = 5200 Width = 3375 End Begin VB.Label Label5 AutoSize = -1' True Caption = "topic:" Height = 180 Left = 240 TabIndex = 11 Top = 1320 width = 450 end job vb.label label4 autosize = -1 'true caption = "SMTP server" height = 180 left = 0 TabINDEX = 10 TOP = 960 Width = 900 End Begin VB.Label Label3 AutoSize = -1 'True Caption = "Password" Height = 180 Left = 3360 TabINDEX = 8 TOP = 1200 width = 360 End Begin vb.Label Label2 AutoSize = -1' True Caption = " Received address "Height = 180 left = 0 TabINDEX = 6 TOP = 600 width =

900 End Begin VB.Label Label1 AutoSize = -1 'True Caption = "sender address" Height = 180 Left = 0 TabIndex = 4 Top = 240 Width = 900 EndEndAttribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = False 'program combination: dapha (Wang Feng)' download http://www.dapha.net 'I am a VB lovers, I hope everyone's help, learn together, progress Private Enum SMTP_State MAIL_CONNECT MAIL_HELO MAIL_from MAIL_RCPTTO MAIL_DATA MAIL_DOT MAIL_QUIT mAIL_USER MAIL_PASS mail_loginEnd EnumPrivate m_State As SMTP_StatePrivate m_strEncodedFiles As StringPrivate Function Base64_Encode (strSource) As String 'base6 encryption algorithm Const BASE64_TABLE As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 /" Dim strTempLine As String Dim j As Integer For j = 1 To (Len (strSource ) - LEN (STRSOURCE) MOD 3) Step 3 Strtempline = S TRTEMPLINE MID (Base64_Table, (ASC (STRSOURCE, J, 1)) / 4) 1, 1) StrtemPline = Strtempline MID (Base64_Table, ((ASC (STRSOURCE, J, 1)) MOD 4) * 16_ ASC (MID (STRSOURCE, J 1, 1)) / 16) 1, 1) Strtempline = StrtemPline MID (Base64_Table, ((ASC (STRSOOURCE, J 1, 1)) MOD 16 ) * 4 _ ASC (STRSOURCE, J 2, 1)) / 64) 1, 1) Strtempline = StrtemPline MID (Base64_Table, (ASC (STRSOURCE, J 2, 1)) MOD 64 )

1, 1) Next J IN NOT (LEN (STRSOURCE) MOD 3) = 0 THEN IF (LEN (STRSOURCE) MOD 3) = 2 Then Strtempline = StrtemPline MID (Base64_Table, (ASC (STRSource, J, 1) ) / 4) 1, 1) strTempline = strTempline MID (Base64_Table, (ASC (STRSOURCE, J, 1)) MOD 4) * 16 _ ASC (MID (STRSOURCE, J 1, 1)) / 16 1, 1) StrtemPline = StrtemPline MID (Base64_Table, (ASC (STRSOURCE, J 1, 1)) MOD 16) * 4 1, 1) StrtemPline = Strtempline & "=" Elseif (LEN (STRSource ) MOD 3) = 1 Then Strtempline = StrtemPline MID (Base64_Table, ASC (MID (STRSOURCE, J, 1)) / 4 1, 1) STRTEMPLINE = STRTEMPLINE MID (Base64_Table, (ASC (STRSOURCE, J, 1)) Mod 4) * 16 1, 1) strTempLine = strTempLine & "==" End If End If Base64_Encode = strTempLineEnd FunctionPrivate Sub cmdExit_Click () Unload MeEnd SubPrivate Sub CmdSend_Click () Winsock1.Close Winsock1.LocalPort = 0 strserver = txtserver ColonPos = InStr (strserver, ":") If ColonPos = 0 Then Winsock1.Connect strserver, 25 Else lngPort = CLng (Right $ (strserver, Len (strserver) - ColonPos)) strserver = Left $ (strserver, ColonPos - 1 Winsock1.connect strser, lngport end if m_state = mail_connect 'statustxt = "tries to connect to the server" End Sub "

Private Sub Winsock1_DataArrival (ByVal bytesTotal As Long) Dim strServerResponse As String Dim strResponseCode As String Dim strDataToSend As String 'Const RandString As String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" Dim Globalstr As String For jd = 1 To 24 uniquey = Int (Rnd * Len (RandString) ) 1 Globalstr = Globalstr Mid (RandString, uniquey, 1) Next jd strime1 = "Subject:" Chr (32) subject vbCrLf 'Subject of E-mail strime = txtMessage vbCrLf' E-mail message body strime2 = "X-mailer: Program Pacific: Mail Send Software V1.0" VBCRLF 'What Program Sent The E-mail, Customize this' multi-part edit strime = "------ = _ nextpart_" GlobalStr VBCRLF "Content-Type: Text / Plain; Charset = GB2312" VBCRLF VBCRLF STRIME STRIME = Strime "------ = _ NextPART_" GlobalStr VBCRLF "Content-Type: Text / HTML" VBCRLF VBCRLF TXTMESSAGE1 VBCRLF VBCRLF STRIME = Strime "------ = _ nextpart_" GlobalStr "-" " " MIME-VERSITION: 1.0 " VBCRLF " Content-Type: Multipart / Alternative; " VBCRLF CHR (9) " Boundary = "---- = _ NextPart_ " GlobalStr " "" VBCRLF VBCRLF "This Mail is in mime format. Your mail interface does NOT APPEAR to Support this format." VBCRLF VBCRLF strimeAll = Strime2

strime1 Winsock1.GetData strServerResponse strResponseCode = Left (strServerResponse, 3) If strResponseCode = "250" Or _ strResponseCode = "220" Or _ strResponseCode = "354" Or _ strResponseCode = "334" Or _ strResponseCode = "235" Then Select Case m_State Case MAIL_CONNECT m_State = MAIL_HELO strDataToSend = Trim $ (txtfrom) 'strDataToSend = Left $ (strDataToSend, _ InStr (1, strDataToSend, "@") - 1) Winsock1.SendData "HELO" & strDataToSend & vbCrLf StatusTxt = "login server "Case MAIL_HELO m_State = mAIL_USER Winsock1.SendData" AUTH LOGIN "& vbCrLf StatusTxt =" is verifying the user name "Case mAIL_USER m_State = MAIL_PASS Winsock1.SendData (Base64_Encode (Trim (user.Text))) & vbCrLf StatusTxt =" check User Password "Case Mail_pass m_State = mail_login Winsock1.SendData (Base64_Encode (txtpwa)) & vbCrLf StatusTxt = "Sender email address" Case mail_login m_State = MAIL_from Winsock1.SendData "MAIL FROM:" & Trim $ (txtfrom) & vbCrLf StatusTxt = "recipient e-mail address "Case mail_from m_state = mail_rcptto winsock1.senddata" RCPT TO: "& TRIM $ (getaddress) & vbcrlf statustxt =" Mail is sent ... "

转载请注明原文地址:https://www.9cbs.com/read-4812.html

New Post(0)