Email using API [shell32.dll]

In this category you can exchange your programming questions and solutions.
Darren
Posts: 63
Joined: Wed May 11, 2011 11:55 am

Email using API [shell32.dll]

Post: # 864Post Darren
Wed Apr 18, 2012 12:25 pm

Can somebody try this with Microsoft Outlook Email?

I have updated it!

Declare Email As "ShellExecuteA" Of "shell32.dll"
    hwnd As Long
    lpOperation As String
    lpFile As String
    lpParameters As String
    lpDirectory As String
    nShowCmd As Long
End declare

Dim EmailAddress As String

Dim Subject As String

Dim OutputString As string

EmailAddress = "d.j.smith@aim.com"

Subject = "Darrens Test"

OutputString = "Hello Darren," + Cr

OutputString = OutputString + "How are you?" + Cr

OutputString = OutputString + "" + Cr

OutputString = OutputString + "Hope that you are fine!" + Cr

OpenMailBox(EmailAddress, Subject, OutputString)

Sub OpenMailBox(Address As String, Subject As String, Body As String)
    Email.lpoperation = "open"
    Email.lpfile = "mailto:" + Address + "?subject=" + Subject + "&body=" + ReplaceSubStr$(OutputString, Chr$(13), "%0D%0A")
    Email.Execute

    Sleep 3000

    SendKeys ("%s")
End Sub

It automatically creates an email and then sends it.

Please let me know what happens!

Darren

Post Reply