Solved

POP mail without mail control?

Posted on 1998-07-26
5
191 Views
Last Modified: 2013-11-13
I would like to send mail directly to a pop mail server account without using the msmail control or any other control.  Can someone tell me the api calls or other way to do this without using an ocx?
0
Comment
Question by:LaurieT
  • 3
5 Comments
 

Author Comment

by:LaurieT
ID: 1466711
Thanks in advance,
Laurie
0
 
LVL 3

Expert Comment

by:SPECIALIST
ID: 1466712
Sub MapiSendMail()
           Dim objSession As Object
           Dim objMessage As Object
           Dim objRecipient As Object
           Dim sProfile As String
           Dim sSubjPrmpt As String
           Dim sTextPrmpt As String
           Dim sEmailPrmpt As String
           Dim sMsgTitle As String
           ' Leaving sProfile equal to Null will
           ' force the user to select which Mapi
           ' profile to use. To keep from being
           ' prompted, you must supply a valid
           ' user profile.
           sProfile = ""
           sEmailPrmpt = "Enter valid Email Name of message recipient:"
           sSubjPrmpt = "Enter the subject line for this message:"
           sTextPrmpt = "Enter the text for this message:"
           sMsgTitle = "Mapi Macro Example"
           ' Create the Session Object.
           Set objSession = CreateObject("mapi.session")
           ' Log on using the session object.
           ' Specify a valid profile name if you want to
           ' avoid the logon dialog box.
           objSession.Logon profileName:=sProfile
           ' Add a new message object to the OutBox.
           Set objMessage = objSession.Outbox.Messages.Add
           ' Set the properties of the message object.
           objMessage.Subject = InputBox(sSubjPrmpt, sMsgTitle)
           objMessage.Text = InputBox(sTextPrmpt, sMsgTitle)
           ' Add a recipient object to the objMessage.Recipients collection.
           Set objRecipient = objMessage.Recipients.Add
           ' Set the properties of the recipient object.
           objRecipient.Name = InputBox(sEmailPrmpt, sMsgTitle)
           objRecipient.Resolve
           ' Send the message. Setting showDialog to False
           ' sends the message without displaying the message
           ' or requiring user intervention. A setting of True
           ' displays the message and the user must choose
           ' to Send from within the message dialog.
           objMessage.Send showDialog:=False
           MsgBox "Message sent successfully!"
           ' Log off using the session object.
           objSession.Logoff
        End Sub

This is one way to do it.  Please note that where it says input box, you can make that a textbox, or you can hard code the email address or persons name etc.  If you need help doing that leave me a message!


David
0
 

Author Comment

by:LaurieT
ID: 1466713
I should have added 'without a profile or mail client installed' to my question.  I am familiar with MAPI.  If there are API calls I could make it would be better.  I need it to run on an NT server or workstation without an exchange client installed.  Like let's suppose they are using a different mail client and are not logged in.
0
 
LVL 1

Accepted Solution

by:
Aikema earned 90 total points
ID: 1466714
You 'd have to look at these files and sent the proper commands to the server in order to send mail:

http://eduserv.kahoslg.be/cfk/rfc's/rfc0937.txt
http://eduserv.kahoslg.be/cfk/rfc's/rfc1225.txt
http://eduserv.kahoslg.be/cfk/rfc's/rfc1725.txt

These three files contain all the commands pop2 or pop3 servers will accept

Would the winsock control work for you to use?  That way you'd still have to use a control but not need to have a mail program on those computers.  I can't think of any way to use the api alone to send the messages.
0
 

Author Comment

by:LaurieT
ID: 1466715
This is the root of the answer.  Thanks - I'll be off researching the rest  :)
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This video teaches viewers about errors in exception handling.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

746 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

13 Experts available now in Live!

Get 1:1 Help Now