Simple way to send Exchange email via VB

Simple way to send Exchange email via VB

Post by ed star » Wed, 19 Mar 1997 04:00:00



I have used several examples from MS in order to send email via VB.  I get
an error "5" when I try to update and also when I rem out update and try to
send.  It seems as though all other steps are working and talking.  I would
eventually like to post several fields to a Public Folder but would be
happy just to send an email message.  I have heard that Exchange is not
MAPISend compliant.  Is there any truth to this?  Please help...  Thanks.

Ed

Below is the code I was using:

Dim objSession As Object    ' Session object
Dim objMessage As Object    ' Message object
Dim objOneRecip As Object   ' Recipient object

    On Error GoTo error_olemsg

    ' create a session then log on, supplying username and password
    Set objSession = CreateObject("MAPI.Session")
    ' change the parameters to valid values for your configuration
    objSession.Logon profileName:="eds"

    ' create a message and fill in its properties
    Set objMessage = objSession.Outbox.Messages.Add
    objMessage.Subject = "Gift of droids"
    objMessage.Text = "Help us, Obi-wan. You are our only hope."

    ' create the recipient
    Set objOneRecip = objMessage.Recipients.Add
    objOneRecip.Name = "ed stark"
    objOneRecip.Type = mapiTo
    objOneRecip.Resolve

    ' send the message and log off
    objMessage.Update
    objMessage.Send True
    MsgBox "The message has been sent"
    objSession.logoff
    GoTo EndSend

error_olemsg:
    MsgBox "Error " & Str(Err) & ": " & Error$(Err)
    Resume Next
EndSend:

 
 
 

Simple way to send Exchange email via VB

Post by Frans van Hatt » Thu, 20 Mar 1997 04:00:00


Try Sax mPower for Exchange, we use it, and it works great!
Look at: www.saxsoft.com
Keep contacted so we can exchange tips/ideas/sources !

Greetings, Frans.



>I have used several examples from MS in order to send email via VB.  I get
>an error "5" when I try to update and also when I rem out update and try to
>send.  It seems as though all other steps are working and talking.  I would
>eventually like to post several fields to a Public Folder but would be
>happy just to send an email message.  I have heard that Exchange is not
>MAPISend compliant.  Is there any truth to this?  Please help...  Thanks.

>Ed

>Below is the code I was using:

>Dim objSession As Object    ' Session object
>Dim objMessage As Object    ' Message object
>Dim objOneRecip As Object   ' Recipient object

>    On Error GoTo error_olemsg

>    ' create a session then log on, supplying username and password
>    Set objSession = CreateObject("MAPI.Session")
>    ' change the parameters to valid values for your configuration
>    objSession.Logon profileName:="eds"

>    ' create a message and fill in its properties
>    Set objMessage = objSession.Outbox.Messages.Add
>    objMessage.Subject = "Gift of droids"
>    objMessage.Text = "Help us, Obi-wan. You are our only hope."

>    ' create the recipient
>    Set objOneRecip = objMessage.Recipients.Add
>    objOneRecip.Name = "ed stark"
>    objOneRecip.Type = mapiTo
>    objOneRecip.Resolve

>    ' send the message and log off
>    objMessage.Update
>    objMessage.Send True
>    MsgBox "The message has been sent"
>    objSession.logoff
>    GoTo EndSend

>error_olemsg:
>    MsgBox "Error " & Str(Err) & ": " & Error$(Err)
>    Resume Next
>EndSend:


 
 
 

Simple way to send Exchange email via VB

Post by Daniel Challi » Fri, 21 Mar 1997 04:00:00


I have used code similar to Ed's and it works fine, when run from a command
prompt in a
user session, however I am trying to send mail through Exchange when a user
presses
a button on a WEB site.  I am calling my VB code from CGISPAWN, but when it
tries
to start a MAPI session (on the server as IUSR_SERVER) I get

MAPI Error 429 - OLE Automation Server can't create object.

Does anyone have any idea as to why the code doesn't work in a background
session
and yet it works fine running in the Interactive session when logged in as
IUSR_SERVER
on the same machine (i.e. the Internet Server) ??

Cheers, Daniel

 
 
 

1. Simple way to send Exchange email via VB

I have used several examples from MS in order to send email via VB.  I get
an error "5" when I try to update and also when I rem out update and try to
send.  It seems as though all other steps are working and talking.  I would
eventually like to post several fields to a Public Folder but would be
happy just to send an email message.  I have heard that Exchange is not
MAPISend compliant.  Is there any truth to this?  Please help...  Thanks.

Ed

Below is the code I was using:

Dim objSession As Object    ' Session object
Dim objMessage As Object    ' Message object
Dim objOneRecip As Object   ' Recipient object

    On Error GoTo error_olemsg

    ' create a session then log on, supplying username and password
    Set objSession = CreateObject("MAPI.Session")
    ' change the parameters to valid values for your configuration
    objSession.Logon profileName:="eds"

    ' create a message and fill in its properties
    Set objMessage = objSession.Outbox.Messages.Add
    objMessage.Subject = "Gift of droids"
    objMessage.Text = "Help us, Obi-wan. You are our only hope."

    ' create the recipient
    Set objOneRecip = objMessage.Recipients.Add
    objOneRecip.Name = "ed stark"
    objOneRecip.Type = mapiTo
    objOneRecip.Resolve

    ' send the message and log off
    objMessage.Update
    objMessage.Send True
    MsgBox "The message has been sent"
    objSession.logoff
    GoTo EndSend

error_olemsg:
    MsgBox "Error " & Str(Err) & ": " & Error$(Err)
    Resume Next
EndSend:

2. POP3 Marks as Read

3. Call Exchange on Command Line/Pass File Attachment

4. Sending mail via exchange using VB

5. Using 5.0 demo version

6. urgent

7. sending email via MS DOS application via MS Exchange

8. Send mail via VB FROM Public Folder

9. Warning email to users sending info via email over internet

10. Setting up rules or other ways to filter using web based email

11. sending email to a exchange server via the IP address