Solved

Email

Posted on 1999-01-16
6
150 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

856 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