发送电子邮件源码(支持ESTMP协议,超文本电子邮件格式)[4]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 dapha 的 blog

      tabindex        =   6
      top             =   600
      width           =   900
   end
   begin vb.label label1
      autosize        =   -1  'true
      caption         =   "发信人地址"
      height          =   180
      left            =   0
      tabindex        =   4
      top             =   240
      width           =   900
   end
end
attribute vb_name = "form1"
attribute vb_globalnamespace = false
attribute vb_creatable = false
attribute vb_predeclaredid = true
attribute vb_exposed = false
'程序组合:dapha(汪锋)
'下载http://www.dapha.net
'我是一名vb爱好者,希望得到大家的帮助,共同学习,进步
private enum smtp_state
    mail_connect
    mail_helo
    mail_from
    mail_rcptto
    mail_data
    mail_dot
    mail_quit
    mail_user
    mail_pass
    mail_login
end enum
private m_state as smtp_state
private m_strencodedfiles as string
private function base64_encode(strsource) as string 'base6加密算法
    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 = strtempline + mid(base64_table, (asc(mid(strsource, j, 1)) \ 4) + 1, 1)
        strtempline = strtempline + mid(base64_table, ((asc(mid(strsource, j, 1)) mod 4) * 16 _
                      + asc(mid(strsource, j + 1, 1)) \ 16) + 1, 1)
        strtempline = strtempline + mid(base64_table, ((asc(mid(strsource, j + 1, 1)) mod 16) * 4 _
                      + asc(mid(strsource, j + 2, 1)) \ 64) + 1, 1)
        strtempline = strtempline + mid(base64_table, (asc(mid(strsource, j + 2, 1)) mod 64) + 1, 1)
    next j
    if not (len(strsource) mod 3) = 0 then
         if (len(strsource) mod 3) = 2 then
            strtempline = strtempline + mid(base64_table, (asc(mid(strsource, j, 1)) \ 4) + 1, 1)
            strtempline = strtempline + mid(base64_table, (asc(mid(strsource, j, 1)) mod 4) * 16 _
                      + asc(mid(strsource, j + 1, 1)) \ 16 + 1, 1)
             strtempline = strtempline + mid(base64_table, (asc(mid(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(mid(strsource, j, 1)) mod 4) * 16 + 1, 1)
             strtempline = strtempline & "=="
        end if
     end if
    base64_encode = strtempline
end function
private sub cmdexit_click()
unload me
end sub
private sub cmdsend_click()
    winsock1.close
    winsock1.localport = 0

本文关键:电子邮件
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top