Solved

Email

Posted on 1999-01-16
6
147 Views
Last Modified: 2010-05-03
I need the code to send email from one computer to another that are both connected to the internet.  I want to send an email to screen name "test@test.com" with a subject of "test" and a message of "Test works".  I am just a beginner so can you please explain it so even a beginner can understand?
0
Comment
Question by:MChu
  • 3
  • 3
6 Comments
 
LVL 1

Accepted Solution

by:
Johnn earned 110 total points
Comment Utility
First, goto ms' VB site and get the active messaging library which I believe uses Exchange so as long as you have an exchange profile set up on your win9x machine this should work.

Add a reference to the Active Messaging to your project add this function and call it like this:

Dim Success as Boolean
Success=SendEmail(ProfileName,ProfilePassword,SendToEmailAddress,Subject,Msg)

where:
ProfileName=the ms exchange profile you are using
ProfilePassword=the password of the above profile
.the rest s/b straight forward

Function SendEmail(UserName$, Password$, EmailAddress$, sSubject$, sMsg$) As Boolean
    Dim objSession As Object    ' Session object
    Dim objMessage As message    ' 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")
    objSession.Logon UserName, Password
     
    ' create a message and fill in its properties
    Set objMessage = objSession.Outbox.Messages.Add
    objMessage.Subject = sSubject
    objMessage.Text = sMsg
    '' create the recipient
    With objMessage.Recipients.Add
        .Name = EmailAddress
        .Type = mapiTo
        .Resolve
    End With
    ' send the message and log off
    objMessage.Update
    objMessage.Send showDialog:=False
   
    objSession.Logoff
    SendEmail = True
    Exit Function
     
error_olemsg:
    'MsgBox "Error " & Str(Err) & ": " & Error$(Err)
'    server.SendText Socket, "SENDEMAILERR"
    SendEmail = False
    Resume Next
 
End Function

John
0
 

Author Comment

by:MChu
Comment Utility
I am sorry, I don't understand what exactly I have to dl from the Ms vb site.  Can you please link me directly to the site. Thank you
0
 
LVL 1

Expert Comment

by:Johnn
Comment Utility
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:MChu
Comment Utility
Is there any way to do this without using Exchange.  Also can you link me to where I can dl it?  Thanks for your help so far.
0
 
LVL 1

Expert Comment

by:Johnn
Comment Utility
There's other ways but I only use exchange...

that was the link
try just downloads then(you might have to be registered)
http://msdn.microsoft.com/vbasic/downloads

0
 

Author Comment

by:MChu
Comment Utility
Adjusted points to 110
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now