#include #include Global $oOutlook ; ---------------------------------------------------------------------------- While 1 Global $Sender Global $Address = InputBox('Address', 'Enter the E-Mail address to send message to') Global $CC = "A N Other" Global $Name = InputBox("Name", "Enter the Person's Name") Global $mID = $Address Global $Subject = "Password Reset" Global $SLGPass = InputBox("Password", "Enter the New Password (6 Char Min)") Email2() $Cont = InputBox("Another", "Enter Y or N" ) if $Cont = "N" or $Cont = "n" then ExitLoop Wend ;FUNCTIONS ================================================================================================================================================================================ Func Email2() Global $sSubject = "Password Reset" Global $iBodyFormat = $olFormatHTML Global $sBody = "Message1.html" Global $sTo = $Address & " A N Other" Global $sAttachments = "" Global $oOL = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) ; Access the default outbox folder Global $aFolder = _OL_FolderAccess($oOL, "", $olFolderDrafts) If @error Then Exit MsgBox(16, "OutlookEX UDF", "FolderAccess: @error = " & @error & ", @extended = " & @extended) ; Create a mail item in the default folder Global $oItem = _OL_ItemCreate($oOL, $olMailItem, $aFolder[1], "", "Subject=" & $sSubject, "BodyFormat=" & $iBodyFormat) If @error Then Exit MsgBox(16, "OutlookEX UDF", "ItemCreate: @error = " & @error & ", @extended = " & @extended) ; Set the body according to $iBodyFormat If $iBodyFormat = $olFormatHTML Then _OL_ItemModify($oOL, $oItem, Default, "HTMLBody=" & $sBody) Else _OL_ItemModify($oOL, $oItem, Default, "Body=" & $sBody) EndIf If @error Then Exit MsgBox(16, "OutlookEX UDF", "ItemModify: @error = " & @error & ", @extended = " & @extended) ; Add recipient Global $aRecipients = $sTo ;$aRecipients = StringSplit($sTo, ";", 2) _OL_ItemRecipientAdd($oOL, $oItem, Default, $olTo, $aRecipients) If @error Then Exit MsgBox(16, "OutlookEX UDF", "RecipientAdd: @error = " & @error & ", @extended = " & @extended) ; Add attachments If $sAttachments <> "" Then Global $aAttachments = StringSplit($sAttachments, ";", 2) _OL_ItemAttachmentAdd($oOL, $oItem, Default, $aAttachments) If @error Then Exit MsgBox(16, "OutlookEX UDF", "AttachmentAdd: @error = " & @error & ", @extended = " & @extended) EndIf ; Display item $oItem.Display ; Send mail ; _OL_ItemSend($oOL, $oItem, Default) ;_OL_Wrapper_SendMail($oOL, $Address, $CC, "", "SIMS Learning Gateway", $sBody, $olFormatRichText, $olImportanceHigh) ; If @error Then Return SetError(@error + 6000, @extended, 0) EndFunc