Visual Basic Script To Send Email - Oracle Help Center
Có thể bạn quan tâm
Go to main content
Visual Basic Script to Send Email The following script shows how to send an email:
'************************************************************************************ 'REVIEW INPUT PARAMETERS '************************************************************************************ If WScript.Arguments.Count <> 5 Then Wscript.Echo "You must supply 5 runtime variables." & vbNewLine & "Usage: HFM_LOAD.vbs LoadID CSS_Token OracleInstancePath JavaHomePath OLE_DB_PROVIDER" WSCript.Quit -1 Else LoadID = Wscript.Arguments.Item(0) CSSToken = WScript.Arguments.Item(1) OracleInstancePath = WScript.Arguments.Item(2) JavaHomePath = WScript.Arguments.Item(3) Provider = WScript.Arguments.Item(4) End If '************************************************************************************ '************************************************************************************ 'Initialize FDMEE VB API '************************************************************************************ Set objFDMAPI = CreateObject("fdmapi.clsAppServerDM") WScript.Echo "FDMEE VB API created." blnInit = objFDMAPI.fInitializeMainAPI(CStr(LoadID), CStr(CSSToken), CStr(OracleInstancePath), CStr(JavaHomePath), CStr(Provider)) If blnInit Then WScript.Echo "FDMEE VB API initialized." Else WScript.Quit -1 WScript.Echo "fInitializeMainAPI failed." End If '************************************************************************************ WScript.Echo CBool(True) '************************************************************************************ 'Sample Code '************************************************************************************ If objFDMAPI.API.POVMgr.PPOVLocation = "LOCATION_NAME" Then 'Check Status of LoadID Set objProcessStatus = objFDMAPI.API.MaintenanceMgr.fProcessStatus(objFDMAPI.API.State.GstrPOVLoc, objFDMAPI.API.State.GstrPOVCat, objFDMAPI.API.State.GstrPOVPer) If objProcessStatus.blnImp Then 'Import was successful 'Send an email SendEmail("FromUser@domain.com", "ToUser@domain.com", "Subject", "Import was successful" End If End If '************************************************************************************ '************************************************************************************ 'Destroy objects '************************************************************************************ objFDMAPI.Dispose Set objFDMAPI = Nothing '************************************************************************************ Sub SendEmail(strFromAddress, strToAddress, strSubject,strEmailMsgLine) 'Declare local variables Dim strFromAddress Dim strToAddress Dim strSubject Dim strEmailMsgLine Dim objMsg Dim objConfig Dim intSendUsing Dim strSMTPServer Dim intSendPort 'Initialize Mail Server variables 'SMTP server name strSMTPServer = "YourMailServer" 'CdoSendUsing enumeration-1=use smtp on local machine, 2=use smtp over network intSendUsing = 2 'SMTP port on server intSMTPPort = 25 'Create CDO configuration object Set objConfig = CreateObject("CDO.Configuration") 'Set Config object settings With objConfig.Fields .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = intSendUsing .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTPServer .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")= intSMTPPort .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10 .Update End With 'Create CDO message object Set objMsg = CreateObject("CDO.Message") 'Assign config object to configuration property of message object Set objMsg.Configuration = objConfig 'Set Message object settings and send mail With objMsg .To = strToAddress .From = strFromAddress .Subject = strSubject .TextBody = strEmailMsgLine .Send End With 'Destroy message objects Set objMsg = Nothing Set objConfig = Nothing End SubTừ khóa » Visual Basic Send Email
-
Sending Email From Visual Basic - Stack Overflow
-
VB.Net - Send Email - Tutorialspoint
-
How To Send Email In Visual Basic VB.NET - Codebun
-
How To Send Emails Using VB.NET - YouTube
-
How To: Programmatically Send Email - Visual Studio (Windows)
-
Sending Email Using VBnet And Smtp. - Microsoft Q&A
-
Send Email In VB.NET - Tutorial - AdminSystem Software Limited
-
Send Email In VB 6.0 - Example Codes
-
VBA Send Email From Excel - WallStreetMojo
-
How To Send Email Using VB.Net - The Crazy Programmer
-
Send Email From C# / VB.NET / ASP.NET Using SMTP - GemBox
-
Sending EMails With Visual Basic With LinkedResources ... - CodeGuru
-
What Is SMTP - Net
-
Send An Email With Outlook Using VB .Net - Visual Basic .NET - Bytes