Question

Sending an E-mail using Visual Basic and CDONTS.NewMail

Asked by: comt00006

Hi there.

I want to send a simple E-mail using "Microsoft CDO for NTS 1.2 Library".

Here is the code I have thus far.

START OF VB CODING
--------------------------------------------------------------------------------------------------------------
Option Explicit

Private Sub Command1_Click()

    Dim objNewMail As CDONTS.NewMail
    Set objNewMail = CreateObject("CDONTS.NewMail")
   
    With objNewMail
        .From = "good@address.here"
        .To = "good@address.here"
        .Body = "Here is the body"
        .Subject = "HI THERE"
        .Importance = 1
        .Send
    End With
   
    Set objNewMail = Nothing

End Sub
-------------------------------------------------------------------------------------------------------
END OF VB CODING


The code works fine with no errors but I do not get the E-mail!!!

Does anyone know how to make this work?

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2003-12-30 at 05:48:46ID20837141
Tags

vb

,

visual

,

basic

,

send

,

using

Topics

VB Controls

,

Microsoft Programming

Participating Experts
6
Points
100
Comments
24

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. CDO with VB
    I'm using VB6 and want to create an application, part of which will send email. I've had trouble with this, so I've decided just to create a simple app (form and button) and attempt to use CDO to send the email. The CDO DLL files are registered and I have added the referenc...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: hongjunPosted on 2003-12-30 at 05:51:25ID: 10016036

Option Explicit

Private Sub Command1_Click()
    Dim objNewMail As CDONTS.NewMail
    Set objNewMail = New CDONTS.NewMail
   
    With objNewMail
        .From = "good@address.here"
        .To = "good@address.here"
        .Body = "Here is the body"
        .Subject = "HI THERE"
        .Importance = 1
        .Send
    End With
   
    Set objNewMail = Nothing
End Sub


Check the badmail folder and queue folder for some clue.

 

by: emoreauPosted on 2003-12-30 at 06:06:17ID: 10016103

Try sending a e-mail to your self and in the same domain as your SMTP server because the server may stop relaying.

 

by: comt00006Posted on 2003-12-30 at 06:35:09ID: 10016249

The address that I'm using is an internal E-mail address within the same domain as it is being sent.

 

by: comt00006Posted on 2003-12-30 at 06:38:36ID: 10016260

How do I check the Badmail Folder and the queue folder?

 

by: comt00006Posted on 2003-12-30 at 06:40:42ID: 10016270

Does anyone know how to do this in another way?

 

by: hongjunPosted on 2003-12-30 at 06:44:26ID: 10016292

go to the mailroot folder and then from there you will find the badmail folder.

hongjun

 

by: comt00006Posted on 2003-12-30 at 06:56:30ID: 10016351

No Mailroot folder.

 

by: comt00006Posted on 2003-12-30 at 06:58:35ID: 10016361

I've tried new coding with the same result

Start Coding
---------------------------------------------------------------------------------
Option Explicit

Private Sub Command1_Click()

    Dim obj As Object
   
    Set obj = CreateObject("CDO.Message")
   
    With obj
        .To = "good@address.here"
        .From = "good@address.here"
        .Subject = "testing"
        .TextBody = "Mine"
        .Send
    End With
   
    Set obj = Nothing

End Sub
-----------------------------------------------------------------------------------------------
End Coding


This gives me the same thing. No error but no E-mail.

 

by: hongjunPosted on 2003-12-30 at 07:04:09ID: 10016385

it is usually here
C:\Inetpub\mailroot

hongjun

 

by: emoreauPosted on 2003-12-30 at 07:06:57ID: 10016402

Don't waste your time anymore. Try the free vbSendMail SMTP mailer: http://www.freevbcode.com/ShowCode.Asp?ID=109

 

by: comt00006Posted on 2003-12-30 at 07:09:18ID: 10016410

You are right.

All my messages are in the Queue folder. How do I get them to go into my Outlook Inbox?

 

by: comt00006Posted on 2003-12-30 at 07:22:45ID: 10016482

I downloaded the example and it is far too complicated for what I need. All I need is a simple mail sender. All I want to suply is the name of the sender, name of the receiver, the message and the subject.

 

by: hongjunPosted on 2003-12-30 at 07:32:38ID: 10016535

 

by: comt00006Posted on 2003-12-30 at 07:47:17ID: 10016618

Does anyone know how to send an E-mail using Visual basic 6.0?

 

by: hongjunPosted on 2003-12-30 at 07:49:22ID: 10016630

:)
Your code is doing the right thing.
Try my 2 links above.


hongjun

 

by: hongjunPosted on 2003-12-30 at 07:51:00ID: 10016642

gd luck
i got to sleep now.
Night time here.

 

by: JonGartziaPosted on 2003-12-30 at 08:20:49ID: 10016775

If you can't resolve the problem try MAPI controls (In VB6, components, Microsoft MAPI 6.0 controls). There's a simple explanation in MSDN: Using MAPI controls.

 

by: JonGartziaPosted on 2003-12-30 at 08:24:37ID: 10016796

Visual Basic Concepts

Using the MAPI Controls


The messaging application program interface (MAPI) controls allow you to create mail-enabled Visual Basic applications. MAPI is a set of core system components that seamlessly connect any mail-enabled or workgroup application to MAPI-compliant information services. For example, the Microsoft Exchange messaging system can be connected to most private or public e-mail systems through the use of MAPI drivers.

In Visual Basic, the MAPI controls are used to interact with the underlying message subsystem. To use these controls, you must first install a MAPI-compliant e-mail system like Microsoft Exchange. The underlying messaging services are provided by the workgroup environment — the Microsoft Exchange Server running under Windows 95 (or later) or Windows NT, for instance.

Using the MAPI controls involves two steps: establishing a MAPI session and then using various properties and methods to access and manage an individual Inbox. For example, create and send a message, include a file attachment, verify the recipient's address against the e-mail system's address book, etc.

The MAPISession control signs on and establishes a MAPI session. It is also used to sign off from a MAPI session. The MAPIMessages control contains all the properties and methods needed to perform the messaging system functions described above.

The MAPI controls are invisible at run time. In addition, there are no events for the controls. To use them you must set the appropriate properties or specify the appropriate methods.

Note   If you attempt to run a program that uses the MAPI controls, make sure that you have the 32-bit MAPI DLLs installed properly or you may not be able to perform MAPI functions such as SignOn. For example, on Windows 95 or later, you must install Exchange during the operating system setup, or install it separately from the control panel to correctly use MAPI functions.

Possible Uses
To add messaging functionality to your application.


To create a full-featured electronic mail application.
Using the MAPISession control
The MAPISession control is used to sign in and out of a MAPI session. Assuming that MAPI services are present, logging in with the MAPISession control is merely a matter of providing a registered user name and password. The MAPISession control will determine the electronic mail settings specified in the operating system and invoke the underlying message subsystem (the mail server).

The MAPISession control



Setting MAPISession Properties
You can set the MAPISession properties at design time using the MAPISession Property Pages. Right-click the MAPISession control and click Properties to display the Property Pages dialog box.

Setting the MAPISession properties at design time



The UserName and Password properties are used to provide a valid sign-on to the underlying messaging system. You can either set these properties at design time or prompt the user at run time. Setting the LogonUI property to True will provide the user with the sign-on dialog box of the underlying mail system. If such a dialog box does not exist, this property will be ignored. You can create a custom dialog box to prompt the user for this information.

The NewSession property specifies whether a new mail session should be established. If a valid session is already established, setting the NewSession property will allow two sessions to run concurrently.

The DownloadMail property specifies whether the user's mail will be downloaded at the beginning of the current session automatically. Setting this value to True will download all the user's mail to their Inbox. Depending upon the mail system and the amount of incoming mail, this can be a processing-intensive operation. By setting this property to False, the user can choose to download mail at a later time or set the interval at which mail is automatically downloaded.

The SignOn and SignOff Methods
Once the UserName and Password properties have been set, use the SignOn method at run time to begin the MAPI session.

For example:

mpsSession.SignOn

When the session is established, the session handle is stored in the SessionID property. Depending upon the value of the NewSession property, the session handle may refer to a newly created session or an existing session.

To end the session use the SignOff method.

Note   The Action property can also be used to sign in and out of a MAPI session. It is recommended, however, that you use the SignOn and SignOff methods instead. The Action property is included for compatibility with earlier versions of Visual Basic.

The SessionID Property
When the SignOn method is used to successfully establish a messaging session, the SessionID property will return a unique messaging session handle. The SessionID value will be used by the MAPIMessages control to create an association with a valid messaging session. By default, this value is 0.

Using the MAPIMessages Control
Once you've logged into a messaging session using the MAPISession control, you use the MAPIMessages control to receive, send, or read messages from the Inbox which was specified at sign-on time.

The MAPIMessages control provides you with properties and methods to perform basic electronic mail tasks. For example, composing a message, addressing it to a recipient, verifying that the recipient's address is valid, or attaching a file.

The MAPIMessages control



In most cases, the MAPIMessage control is used to provide e-mail capabilities to certain functions within an application. For example, you may want to send a notification message to a workgroup alias after your application has automatically created a report. In other words, you can add e-mail capabilities to your application, without creating full-fledged e-mail applications.

You can, however, use the MAPI controls to create very powerful mail-enabled and workgroup applications.

Sample Application: VBMail.vbp
The examples in the following sections demonstrate the basic use of MAPI in Visual Basic. For more detailed use of the properties and methods of the MAPI controls refer to the VBMail.vbp sample application, which is listed in the Samples directory.

Note   You can also use the OLE Messaging technology to add MAPI functionality to your application. Information on OLE Messaging can be found in the Microsoft Exchange Software Development Kit.

Associating SessionID Properties
The SessionID property of the MAPIMessages control contains the messaging session handle returned by the SessionID property of the MAPISession control. To associate the MAPIMessages control with a valid messaging session, set this property to the SessionID of a MAPISession control that was successfully signed on. For example:

mpmMessage.SessionID = mpsSession.SessionID

This association to a valid MAPI session must be made before you can access messages and begin working with the MAPIMessages control.

Accessing Messages
Successfully logging into a MAPI session accesses the Inbox of the registered user specified by the UserName and Password properties of the MAPISession control. The Inbox is the message store. When the Inbox is opened two buffers are created: the compose buffer and the read buffer.

The read buffer is made up of an indexed set of messages fetched from the user's Inbox. The MsgIndex property is used to access individual messages within this set, starting with a value of 0 for the first message and incrementing by one for each message through the end of the set.

The message set is built using the Fetch method. The set includes all messages of type FetchMsgType and is sorted as specified by the FetchSorted property. The value of the FetchMsgType property is controlled by the underlying message system. The FetchSorted property can be set to add messages to the message set (read buffer) in the order they are received or in the order specified by the user's Inbox. Previously read messages can be included or left out of the message set with the FetchUnreadOnly property.

Messages in the read buffer can't be altered by the user, but can be copied to the compose buffer for alteration.

Messages are created or edited in the compose buffer. The compose buffer is active when the MsgIndex property is set to –1. Many of the messaging actions are valid only within the compose buffer, such as sending messages, saving messages, or deleting recipients and attachments.

Composing and Managing Messages
Managing messages is the primary function of the MAPIMessages control. Composing, sending, receiving, and deleting messages are performed by using methods that correspond to these basic functions (compose, copy, delete, etc.). The following table lists the MAPIMessages methods that specifically apply to messages:

Method Description
Compose Composes a new message
Copy Copies the currently indexed message to the compose buffer
Delete Deletes a message, recipient, or attachment
Fetch Creates a message set from selected messages in the Inbox
Forward Forwards a message
Reply Replies to a message
ReplyAll Replies to all message recipients
Save Saves the message currently in the compose buffer
Send Sends a message


To perform an action on an individual message, it must first be selected using the MsgIndex property. The message identified by the MsgIndex property is called the currently indexed message.

None of the other message properties can be set until a message is selected with the MsgIndex property. The index number can range from –1 to MsgCount –1 (the MsgCount property returns the total number of messages in the message set.) When a new message is created, the value of the MsgIndex property is set to –1.

Composing a Message
Use the Compose method to create a new message. When the Compose method is used, the compose buffer is cleared and the MsgIndex property is set to –1.

'Compose new message
mpmMessage.Compose

Completing a message involves several steps: determining the recipient of the message, choosing a subject title, and writing the message.

Addressing the Message
To set the recipient's name and address, use the RecipDisplayName and the RecipAddress properties. The RecipDisplayName is the proper name of the recipient, for example, "Richard Tull". The RecipAddress property contains the recipient's e-mail address: "richtull", for example.

'Address message
mpmMessage.RecipDisplayName = "Richard Tull"
mpmMessage.RecipAddress = "richtull"

Addresses for recipients outside the local workgroup (a message sent to someone at another company via the Internet, for example) require a complete Internet e-mail address: "richtull@littlemag.com".

Verifying the Recipient's Name
The recipient's name is verified when the message is sent by checking it against the list of registered users in the e-mail system, using the ResolveName method. Name verification for recipients outside the local workgroup is handled in various ways by the underlying message system.

The following example resolves the recipient's valid e-mail name by invoking the ResolveName method and setting the AddressResolveUI property to True.

' Resolve recipient name
mpmMessage.AddressResolveUI = True
mpmMessage.ResolveName

The AddressResolveUI property can be set to either display a details dialog box (True) or generate an error (False) when an ambiguous or invalid recipient address is encountered when the message is sent. The details dialog box will offer you an alternative address if a close match is found.

The Message Subject and Text
The MsgSubject property specifies the subject line for the message. You may enter up to 64 characters, including the Null character.

The body of the message is contained in the MsgNoteText property. For inbound messages, each paragraph is terminated with a carriage return-line feed pair (vbCrLf). Outbound messages can be delimited with a carriage return (vbCr), line feed (vbLf), or a carriage return-line feed pair.

'Create the message
mpmMessage.MsgSubject = "Status Report"
mpmMessage.MsgNoteText = "Build successful!"

Sending the Message
To send the message, use the Send Method. The Send method allows you to send a message with or without user interaction. Setting the value to True will display the compose message dialog box of the underlying e-mail system (Microsoft Exchange, for example). Setting it to False will send the message without displaying the compose message dialog. The following example sends the message without prompting for user interaction:

'Send the message
mpmMessage.Send False

Handling File Attachments
You can add file attachments to outgoing messages using the file attachment properties. These properties are listed in the following table:

Property Description
AttachmentCount Returns the total number of attachments associated with the currently indexed message.
AttachmentIndex Sets the currently indexed attachment.
AttachmentName Specifies the name of the currently indexed attachment file.
AttachmentPathName Specifies the full path name of the currently indexed attachment.
AttachmentPosition Specifies the position of the currently indexed attachment within the message body.
AttachmentType Specifies the type of the currently indexed file attachment.


To add an attachment to an outgoing message, use the AttachmentPathName property to specify the name and path of the file. For example:

'Add attachment
mpmMessage.AttachmentPathName = "c:\Status _
Report.doc"

If the path name is incorrect or empty, an error will be generated.

Simply specifying the AttachmentPathName property will send the attachment with the message, use the name of the file to display in the message body, and position the attachment at the beginning of the message.

The AttachmentName property can be used to specify a different name for the attached file. If this property isn't set, the actual name of the file will be displayed in the message body.

The AttachmentPosition property is used to position the attachment within the message body. By default, the value is "0" and the attachment is located at the beginning of the message body. To position the attachment at the end of the message, count the number of characters in the message body. For example, in a message body that is five characters long, you could place an attachment at the end of the message by setting the value to 4. (The message body occupies character positions 0 to 4).

Two attachments can't be placed in the same position within the same message. You also can't place an attachment equal to or beyond the end of the message body. You can append an extra space or a vbCrLf character to the end of the message body and then set the AttachmentPosition property to one character less than the length of the MsgNoteText property.

Managing Messages
Many of the remaining properties and methods of the MAPIMessages control can be used to manage messages just as you would in a full-featured e-mail application.

By accessing messages in the read buffer you can sort, delete, or forward one or a number of messages. The following table lists the properties you can use to manage messages:

Property Description
MsgConversationID Specifies the conversation thread identification value for the currently indexed message.
MsgCount Returns the total number of messages present in the message set during the current messaging session.
MsgDateReceived Returns the date on which the currently indexed message was received.
MsgID Returns the string identifier of the currently indexed message.
MsgIndex Specifies the index number of the currently indexed message.
MsgOrigAddress Returns the mail address of the originator of the currently indexed message.
MsgOrigDisplayName Returns the originator's name for the currently indexed message.
MsgRead Returns a Boolean expression indicating whether the message has already been read.
MsgReceiptRequested Specifies whether a return receipt is requested for the currently indexed message.
MsgSent Specifies whether the currently indexed message has already been sent to the mail server for distribution.
MsgType Specifies the type of the currently indexed message.


Working with the Address Book
The e-mail system's address book contains all of the addressing information for each registered user in the e-mail system. The address book is a dialog box which allows the user to look up or verify recipient addresses. The address book properties allow you to set or modify elements of the address book.

The Show Method
The e-mail system's address book is displayed using the Show method. The Show method can be set to show either the address book or the recipient details dialog box.

By default, the value is set to False and the address book dialog box is displayed when the Show method is used.

To display the details dialog box, set the value to True. The amount of information displayed in this dialog box depends upon the e-mail system. At minimum, the name and address of the recipient are displayed.

Address Book Properties
The address book properties allow you to set or modify elements of the e-mail system's address book. The following table lists these properties:

Property Description
AddressCaption Specifies the caption appearing at the top of the address book.
AddressEditFieldCount Specifies which edit controls to display to the user in the address book.
AddressLabel Specifies the appearance of the "To" edit control in the address book.
AddressModifiable Specifies whether the address book can be modified by the user.
AddressResolveUI Specifies whether a dialog box is displayed for receipt name resolution during addressing.


All of the address book properties can be set at design time using the MAPIMessages control's Property Pages dialog box.

Setting the MAPIMessages properties at design time



Setting the address book properties at design time allows you to specify options for the display and functionality of the address book dialog box. For example, you can modify the caption that appears in the address book dialog box using the AddressCaption property.


--------------------------------------------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.

 

by: comt00006Posted on 2003-12-30 at 09:04:23ID: 10017048

Thanks but I think if you use MAPI you need to download a dll from Microsoft and register it to a PC. THere must be a way to use something with VB to send mail without registering anything. If not then I will not create this project.

 

by: hongjunPosted on 2003-12-30 at 18:18:36ID: 10019622

comt00006, if you don't know you are actually using a dll when using cdonts. It is cdonts.dll. When you add references to your project, you are using dll ;)

hongjun

 

by: comt00006Posted on 2003-12-31 at 07:50:13ID: 10021822

True!!

I am now using MAPI (MSMAPI32..OCX) objects. Everything is working fine now but I get the anoying Outlook messagebox "A program is trying to automatically send e-mail on your behalf.".

If anyone knows how to bypass this messagebox PLS help me out.

PS
Thanks for the good replies

 

by: anvPosted on 2004-05-07 at 02:48:09ID: 11013265

hi try the following link

http://www.mapilab.com/articles/vb_outlook_security_4.html

when u try sending mail using CDONT's check if the built-in SMTP server of WIN2K is started ..

to check that... goto
'Administrative Tool'..'Internet Services Manager' n from there u can check if the SMTP server is started or not.. if not then u need to start it to send the mail..

hope i helped

anv

 

by: rggrgg99Posted on 2004-06-07 at 03:55:50ID: 11247728

A bit of a late post, but if you still need to remove the messagebox "A program is trying to automatically send e-mail on your behalf", it is a setting in Outlook Express (and, I would assume, Outlook too). In OE, it's in Tools->Options, 'Security' tab, checkbox 'Warn me when other applications try to send mail as me', checked by default. Uncheck it, and the mail gets sent immediately. Thanks for the useful description of the MAPI objects.

 

by: 11000414Posted on 2004-10-04 at 04:20:17ID: 12216125

Try this code......


  Dim MyCDONTSMail2
    Dim HTML
    Set MyCDONTSMail2 = CreateObject("CDONTS.NewMail")
    HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
    HTML = HTML & "<html>"
    HTML = HTML & "<head>"
    HTML = HTML & "<title>Sending CDONTS Email Using HTML</title>"
    HTML = HTML & "</head>"
    HTML = HTML & "<body bgcolor=""FFFFFF"">"
    HTML = HTML & "<p><font size =""3"" face=""Arial""><strong>"
    HTML = HTML & "Name Of Store</strong><br>"
    HTML = HTML & "Incoming Customer Order</strong></p>"
    HTML = HTML & "<p align = ""center"">Bla Bla Bla Bla Bla</p>"
    HTML = HTML & "MAIL SENT"
    HTML = HTML & "</body>"
    HTML = HTML & "</html>"
    MyCDONTSMail2.From= "sekhar.chandra@wipro.com"
    MyCDONTSMail2.To="sekhar.chandra@wipro.com"
    MyCDONTSMail2.Subject="Incoming Customer Order"
    MyCDONTSMail2.BodyFormat=0
    MyCDONTSMail2.MailFormat=0
    MyCDONTSMail2.Body=HTML
    MyCDONTSMail2.Send
    set MyCDONTSMail2=nothing



Note: before u try Just install teh CDONTS.dll file

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...