找回密码  加入

AUTOIT CN

搜索
楼主: annybaby

[原创] 超迷你邮件发送器,支持中文和附件,有图有真相...送给有需要的朋友...

[复制链接]
发表于 2012-12-23 00:36:21 | 显示全部楼层
好东西一定要看一下!
发表于 2012-12-23 00:36:28 | 显示全部楼层
好东西一定要看一下!
发表于 2012-12-23 00:36:29 | 显示全部楼层
好东西一定要看一下!
发表于 2012-12-23 00:36:31 | 显示全部楼层
好东西一定要看一下!
发表于 2012-12-23 00:36:40 | 显示全部楼层
好东西一定要看一下!
发表于 2012-12-23 13:20:45 | 显示全部楼层
试一下好不好用
发表于 2012-12-23 14:45:26 | 显示全部楼层
支持一下...
发表于 2012-12-24 16:30:45 | 显示全部楼层
看看啥内容?
发表于 2012-12-24 23:58:23 | 显示全部楼层
回复 1# annybaby
论坛有源码的,只是没有加个GUI,我用过以下代码,成功发送,不知道你的是不是一样的?
  1. Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance = "Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
  2.         Local $objEmail = ObjCreate("CDO.Message")
  3.         $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
  4.         $objEmail.To = $s_ToAddress
  5.         Local $i_Error = 0
  6.         Local $i_Error_desciption = ""
  7.         If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
  8.         If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
  9.         $objEmail.Subject = $s_Subject
  10.         If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
  11.                 $objEmail.HTMLBody = $as_Body
  12.         Else
  13.                 $objEmail.Textbody = $as_Body & @CRLF
  14.         EndIf
  15.         If $s_AttachFiles <> "" Then
  16.                 Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
  17.                 For $x = 1 To $S_Files2Attach[0]
  18.                         $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
  19. ;~          ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
  20.                         If FileExists($S_Files2Attach[$x]) Then
  21.                                 ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF)
  22.                                 $objEmail.AddAttachment($S_Files2Attach[$x])
  23.                         Else
  24.                                 ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)
  25.                                 SetError(1)
  26.                                 Return 0
  27.                         EndIf
  28.                 Next
  29.         EndIf
  30.         $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  31.         $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
  32.         If Number($IPPort) = 0 Then $IPPort = 25
  33.         $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
  34.         ;Authenticated SMTP
  35.         If $s_Username <> "" Then
  36.                 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
  37.                 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
  38.                 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
  39.         EndIf
  40.         If $ssl Then
  41.                 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
  42.         EndIf
  43.         ;Update settings
  44.         $objEmail.Configuration.Fields.Update
  45.         ; Set Email Importance
  46.         Switch $s_Importance
  47.                 Case "High"
  48.                         $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "High"
  49.                 Case "Normal"
  50.                         $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Normal"
  51.                 Case "Low"
  52.                         $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Low"
  53.         EndSwitch
  54.         $objEmail.Fields.Update
  55.         ; Sent the Message
  56.         $objEmail.Send
  57.         If @error Then
  58.                 SetError(2)
  59.                 Return $oMyRet[1]
  60.         EndIf
  61.         $objEmail = ""
  62. EndFunc   ;==>_INetSmtpMailCom

  63. ; Com Error Handler
  64. Func MyErrFunc()
  65.         $HexNumber = Hex($oMyError.number, 8)
  66.         $oMyRet[0] = $HexNumber
  67.         $oMyRet[1] = StringStripWS($oMyError.description, 3)
  68.         ConsoleWrite("### COM Error !  Number: " & $HexNumber & "   ScriptLine: " & $oMyError.scriptline & "   Description:" & $oMyRet[1] & @LF)
  69.         SetError(1); something to check for when this function returns
  70.         Return
  71. EndFunc   ;==>MyErrFunc
复制代码
发表于 2012-12-25 10:18:06 | 显示全部楼层
回个看看。是不是我所需要的。
发表于 2012-12-25 12:46:37 | 显示全部楼层
路过,看一下
发表于 2012-12-25 14:59:18 | 显示全部楼层
下來學習!
发表于 2012-12-26 00:22:57 | 显示全部楼层
还有源码????~拿来研究研究
发表于 2012-12-27 19:58:12 | 显示全部楼层
.......................................
发表于 2012-12-28 14:39:41 | 显示全部楼层
学习一下,下来看看
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|小黑屋|手机版|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2019-5-26 06:18 , Processed in 0.062500 second(s), 13 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表