Hello,
I need a simple way to mail from OUTLOOK WEB APP not from OUTLOOK via a VB6 code.
Anyone know how to do that? Any code/link avaliable?
Thanks,
Krunal
Hello,
I need a simple way to mail from OUTLOOK WEB APP not from OUTLOOK via a VB6 code.
Anyone know how to do that? Any code/link avaliable?
Thanks,
Krunal
Short answer: two practical approaches work cleanly without embedding the VB6 WebBrowser control. Either open Outlook on the web’s “compose” deeplink in the user’s default browser so the user manually sends (fields prefilled), or send mail directly from your app/server (SMTP/CDO or, for Exchange Online, Microsoft Graph). (gist.github.com)
If you do not want an embedded WebBrowser (as you said), opening the default browser to a deeplink is simplest. From VB6 you can call ShellExecute with a URL like:
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub OpenOwaCompose()
Dim url As String
url = "https://outlook.office.com/mail/deeplink/compose?to=alice@example.com&subject=Hello&body=Hi%20there"
ShellExecute 0, "open", url, vbNullString, vbNullString, 1
End Sub Caveats: the user must be signed into OWA, some OWA versions limit which params (cc/bcc) or body length/encoding will prefill, and prefilled body text may be treated as plain text (links may not auto-link). Test against your target OWA/version. (gist.github.com)
If you need true programmatic sending (no user click), use an API: for Exchange Online the modern route is Microsoft Graph (the /me/sendMail or users/{id}/sendMail endpoints) and it requires an Azure app registration and OAuth tokens; EWS still exists for on‑prem Exchange but Microsoft is retiring EWS in Exchange Online and recommends Graph. For full automation implement an app-permission or delegated flow as appropriate. (learn.microsoft.com)
Practical VB6 tips: VB6 can call REST (WinHTTP / MSXML) but implementing OAuth2 in VB6 is painful. If you control an SMTP server, CDOSYS (CDO.Message) from VB6 can send via authenticated SMTP (but note Exchange Online and many providers have disabled basic auth—TLS/OAuth changes apply). A pragmatic pattern: build a small modern proxy service (Node/Python/.NET) that handles OAuth and calls Graph, and let the VB6 client call that simple HTTP endpoint. This avoids embedding credentials or complex token logic in legacy VB6. (learn.microsoft.com)
Notes tied to earlier replies: ’s WebBrowser idea will let you script OWA DOM, but it’s brittle across browsers/versions; ’s Outlook/CDO suggestion is correct if Outlook isn’t required (CDO/SMTP); ’s WinHTTP idea is valid for REST calls but remember the OAuth step.
Jump to Post— AndreRet 526Seeing that outlook web app is web based, you can add a web browser to your form and open the web app in your browser.
From there you can populate all the fields with text etc. and send from app.
Jump to Post— AndreRet 526Its a pleasure.
If you google webbrowser and vb6, the following was returned here.
Once you get the basics oon how to use the web browser, post a new thread and we can …
Seeing that outlook web app is web based, you can add a web browser to your form and open the web app in your browser.
From there you can populate all the fields with text etc. and send from app.
hi AndreRet,
thanks for the reply.
is there any code/link available for your solution? i am newbie ti VB.
thanks,
krunal
hi AndreRet,
basically what my req. is when i press button in vb6 then it redirect me to browser(i.e. ff,ie.chrome) and my all values (i.e. Send to, CC, mail subject,etc) also filled in outlook web app respective controls.
i don't want to use webbrowser control....
:)
OUTLOOK WEB APP
OUTLOOK WEB APP
hi AndreRet,
basically what my req. is when i press button in vb6 then it redirect me to browser(i.e. ff,ie.chrome) and my all values (i.e. Send to, CC, mail subject,etc) also filled in outlook web app respective controls.
i don't want to use webbrowser control....
:)hi AndreRet,
basically
hi AndreRet,
basically what my req. is when i press button in vb6 then it redirect me to browser(i.e. ff,ie.chrome) and my all values (i.e. Send to, CC, mail subject,etc) also filled in outlook web app respective controls.
i don't want to use webbrowser control....
:)
so you want something like a form filler?.. I don't know if its posible for vb6. Have you tried using WinHTTP so you can send mail within your app?..
You can either use an Outlook object in VB or use the winsock object. The winsock concept might be li'l confusing. But it doesn't need Outlook to be installed on your system whereas option 1 needs outlook to be installed in the client system. If you still choose winsock, do reply I'll try attaching a class that would send messages.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.