Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MAPI "internet mail" ?

Status
Not open for further replies.

JABOSL

Programmer
Jan 25, 2006
35
I just started writing a program to send the contents of a text box via email. I click the button and it pops up a new mail message with prefilled to, subject and body fields and leaves it there for me to modify and send. As mailto: doesn't allow large bodies I'm using MAPI to do this. What I didn't plan for is when I execute
Code:
Dim myMAPISession As New MSMAPI.MAPISession
Dim myMAPIMessage As New MSMAPI.MAPIMessages

myMAPISession.SignOn()
it brings up a box that says:

Setting up Internet Mail
The Internet Connection Wizard has detected previously installed e-mail software. You can have your Internet mail account settings imported, so you can continue to use them with your new mail program.

Then ask me if I want to create a new mail account or import it from Microsoft Windows Messaging or Exchange or Outlook

What's up with this? I have Mozilla Thunderbird as my defualt mail client but I also use Outlook (not express) for another email account. Both packages work fine and have for almost a year now.

I thought this MAPI was supposed to pull up a new message in my default mail program.

Any ideas?
 
Why don't you just use this free smtp email component?
Get the FreeSmTP component

very easy to use in code.....

Code:
Imports Quiksoft.FreeSMTP

Public Class YourClass

Private Sub SendEmail(ByVal sToEmail As String, ByVal sSubject As String, ByVal sTextMessage As String, Optional ByVal sHtmlMessage As String = "", Optional ByVal sToName As String = "", Optional ByVal sAttachmentName As String = "")

        'Create the EmailMessage object
        Dim msgObj As New EmailMessage
        Try
            'Specify from address and display name
            msgObj.From.Email = txtUserEmailAccount.Text
            'msgObj.From.Name = "My Name"

            'Add a normal recipient
            msgObj.Recipients.Add(sToEmail, sToName, RecipientType.To)

            'Specify the subject
            msgObj.Subject = sSubject

            'Add an HTML body part
            msgObj.BodyParts.Add(sHtmlMessage, BodyPartFormat.HTML)

            'Add a text body part to server as alternative text for non HTML mail readers
            msgObj.BodyParts.Add(sTextMessage, BodyPartFormat.Plain)

            'Add an attachment
            If sAttachmentName.Length > 0 Then
                msgObj.Attachments.Add(sAttachmentName)
            End If

            'Create the SMTP object using the constructor to specify the mail server
            Dim smtpObj As New SMTP(txtMailServer.Text)

            'Send the message
            smtpObj.Send(msgObj)


        Catch ex As Exception
            Throw ex
        End Try

    End Sub

End Class

Hope this helps. IT will require you have an email account, and from the sounds of it you do.

George Oakes
Check out this awsome .Net Resource!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top