Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 30th, 2004, 01:19 AM
Registered User
Join Date: Jan 2004
Location: Mumbai, Maharashtra, India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rambhias
Default Sending email thru Outlook Exp. from VB with html


I want to send automated emails through outlook express using my VB application. The specific requirement is to send the html ow rod formatted text as body of the email. I dont want to send it as an attachment. Mostly, i'll get the data directly from some Word Doc or HTML file or I may use crystal report to generate HTML or Word Doc at run time and then send that text as a body in email. Importantly, the email should not go as an attachment the formatted text must be in body. Is there any way I can achieve the same? If poss. plz. do let me know. Thanks.
Reply With Quote
  #2 (permalink)  
Old February 27th, 2004, 04:18 PM
Registered User
Join Date: Feb 2004
Location: Phoenix, AZ, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

I am having the same problem. I have a C# console app that automates the sending of emails and i need to insert html script as the body.

Reply With Quote
  #3 (permalink)  
Old March 10th, 2004, 08:30 PM
Authorized User
Join Date: Feb 2004
Location: Leeds, West Yorkshire, United Kingdom.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts

Reasonably easy to do: (If I have the right end of the stick!)

1. Right - click your object browser and click components

2. In the Controls tab, choose Microsoft MAPI controls(whichever version)and click OK

3.Add a MAPISession control, a MAPIMessages control and a Command button to a form
Leave them as their original names...

4. Add the following code, putting your e-mail address and recipient address in place of examples :D

Private Sub Command1_Click()

'Create a simple html output for message

stroutput = "<html><div align=""center""><h1>HELLO WORLD</h></div></html>"

'MAPISession1.UserName = "mail@whatever-server.com"
'MAPISession1.Password = "password" You may or may not need these

MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.RecipAddress = "recipient@server.com"

MAPIMessages1.MsgSubject = "VBTest"
MAPIMessages1.MsgNoteText = stroutput

End Sub

This works with my Outlook Express settings but dont forget to allow other programs to send mail in whatever mail application you use

Reply With Quote
  #4 (permalink)  
Old July 7th, 2004, 08:46 PM
Registered User
Join Date: Jul 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts


I tried your suggestion in a VB 6 app using MAPI to create emails through Outlook 2003.

I created the stroutput exactly as you have it, and put it in my MAPIMessages1.MsgNoteText.

The problem is that the email comes out with the HTML commands as raw text instead of the interpreted HTML. In other words, the first line of the email reads:

<html><div aling=""center""><h1>HELLO WORLD</h></div></html>

Any thoughts on why this worked for you in Outlook Express but not for me in Outlook?

Reply With Quote
  #5 (permalink)  
Old November 22nd, 2004, 03:12 AM
bsa bsa is offline
Registered User
Join Date: Aug 2004
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Rambhias
I am having the same problem. Have u found a solution for it. If so, do post the same.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending Email from VB.NET not using outlook hplim18 Pro VB.NET 2002/2003 2 November 23rd, 2008 04:38 AM
ASP: Sending a HTML form to an email address cancer10 Classic ASP Databases 4 February 19th, 2007 05:25 PM
Issue sending HTML file as attachment in EMail kdhawan_forum VB Components 0 April 8th, 2005 02:02 PM
Sending an email without Outlook SaharaWizard Pro VB 6 3 August 12th, 2004 04:15 PM

All times are GMT -4. The time now is 04:44 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.