Solved

Email

Posted on 1999-01-16
6
149 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

772 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