My Blog List

Monday, June 27, 2011

Send Mail from Automation Scripting

Often we have scenarios to send the reports after execution of scripts via scripting. Here is an example...

Dim msg
Set msg = CreateObject("CDO.Message")
msg.Subject="Testing1 Sub"
msg.TextBody="Testing1 Body"
set msg=nothing
msgbox "Finished"

If you guys want to send with detailed things, 
Refer CDO.Message Object reference...

Below lines are optional. But sometimes we need to add these lines to pass....


Steps to create COM Exposed DLL

Open Visual Studio and Create a Project.

1. Create a CLass Library
2. Inside the .vb file, Create a Interface first.
3. Create class by inheriting from Interface.
4. Create Strong Name under "Signing" TAB of Properties.
5. Enable the "Register for Com Interop" under "compile" TAB of Properties
6. Enter the Assembly Information under "Application" TAB of Properties
7. Build the Solution.

After this,

1. Goto "Visual Studio 2010 Command Prompt"
2. Navigate to dll path
3. Register the dll using "regasm" like regasm test.dll /tlb:test.tlb

Now Registry Entries will be done under CLSID and Interface. Then

4. Export to GAC(Global Assembly Cache ie. C:\Windows\Microsoft.Net\Assembly\) using "gacutil.exe" like gacutil /i test.dll

That's all.... We can use the COM application....

Refer the links:

Also you can do by compiling directly through command line. Refer