sethindeed
11-09-2001, 10:18 AM
Hi,
I am using Outlook objects to send emails via my program. But this is bringing me huge limitations :
I can only refer to one version : Office 97 will not work if I chose to join Office 2000 dll's in my project.
Some Outlook applications advise the user when attempting to send automatically an email.
This brought me to the point of considering : Is there a way to send mails without even referring to Outlook at all ?
Thanx :)
Helmar
11-09-2001, 10:54 AM
Sure, several ways:
You could use a tool like IDSMail at http://www.intuitive-data.com
OR, you could use MAPI directly:
Place a MAPI Session and a MAPI Message control on your form.
On Error Resume Next
With MAPISession1
.UserName = "MyName"
.Password = "MyPassword"
.SignOn
If Err <> 0 Then
ErrorMessage = "Error during MAPI signon - " & Error$
else
MAPIMessages1.SessionID = .SessionID
End If
End With
With MAPIMessages1
.Compose
.RecipDisplayName = "XXX@YYY.COM"
.MsgSubject = "Hello there"
.MsgNoteText = "This is the body of the message"
.Send False
End With
sethindeed
11-09-2001, 11:42 AM
And does this require a new dll ?
Because my program is already distributed and I am trying to make my updates via a new EXE as much as possible...
Helmar
11-09-2001, 11:48 AM
This would require MSMAPI32.OCX. I'm not sure if there's a .DLL associated with that.....
You could check by building a small project with the two controls, use the VB package deployment wizard and see what components are included.....
seidreneht
11-09-2001, 10:59 PM
To send and recieve email WITHOUT using Outlook or MAPI
Sending mail is done by the POP3 protocol and recieving is done by the SMTP protocol. In general this is how an email app will communicate with an email server and retrive email.
1. Connect to the email server in the correct port (POP3 > port number =110)
2. Login as a user
3. Send commands to recieve mail
4. Logout
This is fairly simple. You can do this with winsock or Telnet. To this through Telnet this is what you should do.
connect to 'pop.mail.yahoo.com'; port '110'
you will get a reply something like '+OK'
then you have to login, for that type this
USER username
you will get a reply like '+OK'
then enter the password like this
PASS password
you will get a positive reply if the username and password is correct else something like '-ERR'
if you get an error you have to try again, If the login is success full you will get a reply. You should get a reply like '+OK' and some other data continuing this telling you how many mails are there.
To retrieve the whole mail you have to type
RETR msgnumber
you will get the whole message as it is in the server. The mail will be in a standard format that is accepted by all the people who use the internet. For more information about the format go to'www.faqs.org' and search throught the RFC's.
To delete a message
DELE msgnumber
the server will delete the message
to quit type
QUIT
the server will logout and your connection will be closed
These commands can be sent via winsock with a little bit of programming knowledge. The servers replies can be retrieved from the Getdata function and you can send commands with the Senddata function.
The commands I listed above are few of the commands. To see the whole lot of command I suggest you to go to 'www.faqs.org' and look for the 'RFC 1939'
To send mail through SMTP I think there was a tute by ChiefRedBull or someone else. Check that.
To get the whole commands of the SMTP protocol go to 'www.faqs.org' and look for 'RFC 821'
I was in a hurry to tell everyone that there is a wat to send mail without using Outlook. I have alson included the two webpages that have the POP3 and SMTP commands and how they are to be used to get positive results. I hope I will be able to complete a project that will send and recieve mail using these concepts. But now I have to turn off the computer and study for my O-Level exams next year. Any comments are welcome!
Seidren
ChiefRedBull
11-10-2001, 06:53 AM
Theres a short intro to the SMTP protocols via HotMails free service in the tutors corner. it doesn't go into attachments, but everything else is covered. Theres even a sample telnet app that you can practice with.
Chief