sending a email via VB

How do I send out an email message in
VB code that by passes the usual user logins and pwd checks?

The Help file in MSDN Help illustrates an example of the Send method (CDONTS

I made a copy of it and tried to send
a short email to myself but to no avial.

There were no errors during compilation.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

    Reserved As Long
    flags As Long
    Position As Long
    PathName As String
    FileName As String
    FileType As String
End Type

    Reserved As Long
    Subject As String
    NoteText As String
    MessageType As String
    DateReceived As String
    ConversationID As String
    flags As Long
    RecipCount As Long
    FileCount As Long
End Type
    Reserved As Long
    RecipClass As Long
    Name As String
    Address As String
    EIDSize As Long
    EntryID As String
End Type
Private Declare Function MAPISendMail Lib "VBAMAP32.DLL" Alias "BMAPISendMail" (ByVal Session As Long, ByVal UIParam As Long, Message As MAPIMESSAGE_TYPE, Recipient As MAPIRECIP_TYPE, file As MAPIFILE_TYPE, ByVal flags As Long, ByVal Reserved As Long) As Long

private sub SenMyMess()
    Dim typMapiMsg As MAPIMESSAGE_TYPE
    Dim typMapiRecip As MAPIRECIP_TYPE
    Dim typMapiFile As MAPIFILE_TYPE
    Dim lSessionID As Long
    dim Result as long

        typMapiMsg.Subject = "My Subject"
        typMapiMsg.NoteText = "My note" & Time & Space(3) & Date
        typMapiMsg.MessageType = "IPM."         'MAPI_INTER_PERSONAL_MAIL_PREFIX
        typMapiMsg.RecipCount = 1               'one recipient
        typMapiMsg.FileCount = 0
        typMapiRecip.RecipClass = 1             'MAPI_TO
        typMapiRecip.Name = ""
        Result = MAPISendMail(lSessionID, 0, typMapiMsg, typMapiRecip, typMapiFile, 1, 0) 'MAPI_LOGON_UI
end sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
spidysengAuthor Commented:

Dear Maximka,

i tried to compile the code that you have shared and an error occurred with the function declaration line highlihted saying "Only comments are allowed after End Function, End Sub or
End Type.

Could you help please, thanks.

Please explane what happend .
If I interstand right You got Compile error
there are 2 options
or You did not copied right the code
(by the way the declaration has to be on one line )

or You don't have the VBAMAP32.DLL
spidysengAuthor Commented:
thanx man....
You wellcome !!!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.