Solved

POP mail without mail control?

Posted on 1998-07-26
5
196 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Question has a verified solution.

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

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
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.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

696 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