Mosquitos Posted December 7, 2006 Share Posted December 7, 2006 How can i get this to work please? Func _INetSmtpMailCom($s_SmtpServer = "", $s_FromName = "", $s_FromAddress = "", $s_ToAddress = "", $s_Subject = "", $as_Body = "", $s_Username = "", $s_Password = "") $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress If Not $s_ToAddress = "emailadres1@...." Or "emailadres2@...." Or "emailadres3@...." Then GUICtrlSetData($myedit, "Status: Ongeldig EmailAdres!!!") EndIf Sapiente vince, rex, noli vincere ferro! Link to comment Share on other sites More sharing options...
Mosquitos Posted December 12, 2006 Author Share Posted December 12, 2006 (edited) Did i something wrong? Is there nobody who wants to help me please? expandcollapse popup#include <GUIConstants.au3> opt("TrayMenuMode", 1) opt("TrayOnEventMode", 1) $mailserver = "smtp.gmail.com" $username = "******@gmail.com" $password = "******" $yourname = @UserName $youremail = "******@gmail.com" $subject = "Deze Email Niet Beantwoorden AUB..." AdlibEnable("ReduceMemory", 5000) Func ReduceMemory($i_PID = -1) Local $ai_R = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1) Return $ai_R[0] EndFunc FileInstall("Iemants.bmp", @TempDir & "\Iemants.bmp",1) $Picture = @TempDir & "\Iemants.bmp" Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $GUI = GUICreate("Email", 350, 220, -1, -1) GUISetBkColor(0x00008B) $To = GUICtrlCreateLabel("Naar :", 15, 8, 70) GUICtrlSetColor($To, 0xFFFFFF) GUICtrlSetFont($To, 14) $Bodylabel = GUICtrlCreateLabel("Body :", 15, 65, 70) GUICtrlSetColor($Bodylabel, 0xFFFFFF) GUICtrlSetFont($Bodylabel, 14) $toaddressin = GUICtrlCreateCombo("",83,5,262,25) GuiCtrlSetData($toaddressin, "1@iemco.be|2@iemco.be|3@iemco.be") GUICtrlSetFont($toaddressin, 14) $body = GuiCtrlCreateEdit("", 83, 40, 262, 140, 0x50231104) GUICtrlSetFont($body, 14) $Send = GUICtrlCreateButton("Send", 15, 107, 53, 53, $BS_BITMAP) GUICtrlSetImage(-1, $Picture) GUICtrlSetTip(-1,"Verzend Email") GuiCtrlCreateLabel("©Boenders Jos", 5, 170, 70, 10) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetFont(-1, 8, 500) $myedit = GUICtrlCreateEdit ("Status: Klaar", 5, 185, 340, 30, $WS_DISABLED) GUICtrlSetFont($myedit, 15) GUISetState(@SW_SHOW) $Close = TrayCreateItem ("Close") TrayItemSetOnEvent (-1, "Close") TraySetState () While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Close() Case $msg = $Send GUICtrlSetData($myedit, "Status: Even Geduld AUB...") $toaddress = GUICtrlRead($toaddressin) $bodymsg = GUICtrlRead($body) $rc = _INetSmtpMailCom($mailserver, $yourname, $youremail, $toaddress, $subject, $bodymsg, $username, $password) EndSelect WEnd Func _INetSmtpMailCom($s_SmtpServer = "", $s_FromName = "", $s_FromAddress = "", $s_ToAddress = "", $s_Subject = "", $as_Body = "", $s_Username = "", $s_Password = "") $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress If Not $s_ToAddress = "1@iemco.be" Or "2@iemco.be" Or "3@iemco.be" Then GUICtrlSetData($myedit, "Status: Ongeldig EmailAdres!!!") EndIf Local $i_Error = 0 Local $i_Error_desciption = "" $objEmail.Subject = $s_Subject If StringInStr($as_Body,"<") and StringInStr($as_Body,">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 90 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True $objEmail.Configuration.Fields.Update $objEmail.Send If @error Then SetError(2) Return $oMyRet[1] Else GUICtrlSetData($myedit, "Status: Email Verzonden") EndIf EndFunc Func MyErrFunc() GUICtrlSetData($myedit, "Status: Email Niet Verzonden!") $HexNumber = Hex($oMyError.number, 8) $oMyRet[0] = $HexNumber $oMyRet[1] = StringStripWS($oMyError.description,3) ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF) SetError(1) Return EndFunc Func Close() GUISetState(@SW_HIDE) AdlibDisable() FileDelete(@TempDir & "\Iemants.bmp") Sleep(100) Exit EndFunc If Not $s_ToAddress = "1@iemco.be" Or "2@iemco.be" Or "3@iemco.be" Then GUICtrlSetData($myedit, "Status: Ongeldig EmailAdres!!!") EndIf Edited December 12, 2006 by Mosquitos Sapiente vince, rex, noli vincere ferro! Link to comment Share on other sites More sharing options...
Developers Jos Posted December 12, 2006 Developers Share Posted December 12, 2006 (edited) You are not very specific on what your error is ... Are any errors displayed in the output pane of Scite ? Edited December 12, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Mosquitos Posted December 12, 2006 Author Share Posted December 12, 2006 You are not very specific on what your error is ...Are any errors displayed in the output pane of Scite ?There is no error but when i use another emailadres then the 3 in the combo he sending the email.I want that you can send only email to the 3 in the combo. Sapiente vince, rex, noli vincere ferro! Link to comment Share on other sites More sharing options...
Developers Jos Posted December 12, 2006 Developers Share Posted December 12, 2006 Ok that info helps... try this: If $s_ToAddress <> "1@iemco.be" And $s_ToAddress <> "2@iemco.be" And $s_ToAddress <> "3@iemco.be" Then GUICtrlSetData($myedit, "Status: Ongeldig EmailAdres!!!") EndIf SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now