email

hi

well i want to send mail through mapi messages but it should connect to net through vb and  send mail from vb not from any default mail sender like outlook or eudora\

please help

fast it is urgent

thanks in advance
sonal
sonalchouhanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mcriderCommented:
Check out this microsoft KB article.  It's for VB2/3, but the concepts are the same for VB5/6. Just use the Microsoft MAPI control (MSMAPI32.OCX) instead of the MSMAPI.VBX that the article describes...

How to Send a Mail Message Using Visual Basic MAPI Controls
http://support.microsoft.com/support/kb/articles/Q113/0/33.asp?LNG=ENG&SA=MSDN 
 

Cheers!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mcriderCommented:
There is also an example in your VB directory in SAMPLES\COMPTOOL\VBMAIL


Cheers!
0
sonalchouhanAuthor Commented:
well that code also opens the outlook express or microsoft outlook i want it to connect the net and just send the mail the mail id should be picked up from database


thanks tell me if u have any solution
sonal
0
angel_eyesCommented:
I aggree - the question was not answered at all!
Is there no way of the ocx without using outlook express or outlook?
0
mcriderCommented:
The only other way to send mail is SMTP using the winsock control.

Here is a subroutine that will send a message with attachment to an SMTP Server...  This subroutine assumes that you have already connected to the mail server with a winsock control (Winsock1).  The attachment must be a file that has already been uuencoded.

When using the winsock control, you connect to the server on port 25.



Cheers!®©



THE CODE:

    Sub SendMessage(FromAddr As String, ToAddr As String, Subject As String, Msg As String, Attachment As String)
        Dim fNum As Integer
        Dim AttachData As String
         
        With Winsock1
            .SendData "HELO " + CStr(.LocalIP) + vbCrLf
            DoEvents
            .SendData "MAIL FROM: <" + FromAddr + ">" + vbCrLf
            DoEvents
            .SendData "RCPT TO: <" + ToAddr + ">" + vbCrLf
            DoEvents
            .SendData "DATA" + vbCrLf
            DoEvents
            .SendData "SUBJECT: " + Subject + vbCrLf
            DoEvents
            .SendData "FROM: " + FromAddr + vbCrLf
            DoEvents
            .SendData "REPLY-TO: <" + ToAddr + ">" + vbCrLf
            DoEvents
            .SendData "DATE: " + CStr(Now) + vbCrLf + vbCrLf
            DoEvents
            .SendData Msg + vbCrLf + vbCrLf + vbCrLf
            DoEvents
            If Not Attachment = "" Then
                DoEvents
                fNum = FreeFile
                Open Attachment For Binary Access Read As fNum
                AttachData = Space(LOF(fNum))
                Get #fNum, , AttachData
                Close #fNum
                .SendData AttachData
                DoEvents
            End If
            .SendData vbCrLf + vbCrLf + "." + vbCrLf
            DoEvents
            .SendData "QUIT" + vbCrLf
            DoEvents
        End With
    End Sub


0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.