Solved

Email

Posted on 1999-01-16
6
148 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
ID: 1468965
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
ID: 1468966
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
ID: 1468967
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:MChu
ID: 1468968
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
ID: 1468969
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
ID: 1468970
Adjusted points to 110
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…

910 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

16 Experts available now in Live!

Get 1:1 Help Now