Solved

POP mail without mail control?

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

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

Suggested Solutions

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…
This article will show, step by step, how to integrate R code into a R Sweave document
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
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.

919 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