Sending Email with .Net Framework 2.0 and MAPI
Sending Email with .Net Framework 2.0 and MAPI
Sending Email with .Net Framework 2.0 and MAPI
Sending Email with .Net Framework 2.0 and MAPI
Sending Email with .Net Framework 2.0 and MAPI
Sending Email with .Net Framework 2.0 and MAPI Sending Email with .Net Framework 2.0 and MAPI Sending Email with .Net Framework 2.0 and MAPI Sending Email with .Net Framework 2.0 and MAPI Sending Email with .Net Framework 2.0 and MAPI Sending Email with .Net Framework 2.0 and MAPI Sending Email with .Net Framework 2.0 and MAPI Sending Email with .Net Framework 2.0 and MAPI
Sending Email with .Net Framework 2.0 and MAPI Sending Email with .Net Framework 2.0 and MAPI
Sending Email with .Net Framework 2.0 and MAPI
Go Back  Xtreme Visual Basic Talk > > > Sending Email with .Net Framework 2.0 and MAPI


Reply
 
Thread Tools Display Modes
  #1  
Old 07-31-2006, 01:54 PM
flipside82 flipside82 is offline
Regular
 
Join Date: Nov 2003
Posts: 73
Default Sending Email with .Net Framework 2.0 and MAPI


I cannot figure out how to send an email message from my application using MAPI commands and the new .net framework 2.0. I've read that I have to use system.net.mail. Any help in getting started would be much appreciated.
Reply With Quote
  #2  
Old 08-01-2006, 08:35 AM
shaul_ahuvaSending Email with .Net Framework 2.0 and MAPI shaul_ahuva is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Jul 2003
Location: Camp Hill, PA
Posts: 1,992
Default

System.Net.Mail contains a SMTP client. Try googling - I'm sure there are more than a few managed MAPI clients floating around out there...
Reply With Quote
  #3  
Old 08-01-2006, 11:51 AM
flipside82 flipside82 is offline
Regular
 
Join Date: Nov 2003
Posts: 73
Default

Is MAPI not available in 2005 with .NET Framework 2.0? Becuase I don't have the SMTP service started on my machine and I cannot start it. Is there a way to send an email with the GroupWise application through VB?
Reply With Quote
  #4  
Old 08-01-2006, 12:08 PM
shaul_ahuvaSending Email with .Net Framework 2.0 and MAPI shaul_ahuva is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Jul 2003
Location: Camp Hill, PA
Posts: 1,992
Default

.NET doesn't include a MAPI client.

Are you getting an error when starting the SMTP server in IIS? Also, you don't necessarily need to have a SMTP server on your local machine - you can specify the name of the mail server to use.

I don't know anything about GroupWise - I would suggest googling.
Reply With Quote
  #5  
Old 08-01-2006, 12:10 PM
flipside82 flipside82 is offline
Regular
 
Join Date: Nov 2003
Posts: 73
Default

It's not that I get an error when starting the SMTP service, but I'm not able to do on our work machines. How can I specify a server to use? I'm pretty new to VB.net and SMTP.
Reply With Quote
  #6  
Old 08-01-2006, 12:23 PM
wayneph's Avatar
waynephSending Email with .Net Framework 2.0 and MAPI wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

When you create an instance of the SMTPClient objct you can pass a servername into the constructor. That will tell it to use a different server. I think that GroupWise should probably have an SMTP interface set up. Ask your network admin to be sure.
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #7  
Old 08-01-2006, 12:55 PM
flipside82 flipside82 is offline
Regular
 
Join Date: Nov 2003
Posts: 73
Default

Well I'm getting further, but my smtp server requires authentication and I'm not sure where to enter my username and password to login to the smtp server?
Reply With Quote
  #8  
Old 08-01-2006, 02:04 PM
flipside82 flipside82 is offline
Regular
 
Join Date: Nov 2003
Posts: 73
Default

Here's what I have:

Code:
Private Sub cmdSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSubmit.Click
        Dim mailMsg As New MailMessage("from address", "to address")
        With mailMsg
            .Subject = "Test"
            .Body = "This is a test"

        End With
       
            Dim client As New SmtpClient("host address", port number)
            client.Credentials = New Net.NetworkCredential("username", "password")
            client.Send(mailMsg) -- This is where I get the Authentication message
        
        End Sub
Reply With Quote
  #9  
Old 08-01-2006, 02:46 PM
shaul_ahuvaSending Email with .Net Framework 2.0 and MAPI shaul_ahuva is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Jul 2003
Location: Camp Hill, PA
Posts: 1,992
Default

Try using System.Net.CredentialCache.DefaultCredentials or System.Net.CredentialCache.DefaultNetworkCredentials - both are normally the current user's credentials.
Reply With Quote
  #10  
Old 08-02-2006, 07:22 AM
flipside82 flipside82 is offline
Regular
 
Join Date: Nov 2003
Posts: 73
Default

No matter what I type for the credentials, I still get the same error when running the app. Does the credential code have to placed in a specific spot? Running out of ideas.
Reply With Quote
  #11  
Old 08-02-2006, 08:46 AM
shaul_ahuvaSending Email with .Net Framework 2.0 and MAPI shaul_ahuva is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Jul 2003
Location: Camp Hill, PA
Posts: 1,992
Default

The credentials need to be provided before you attempt to connect. If you don't know your username and password (which appear to be different from your network credentials), you'll need to get them.

Ask your network admin (or whoever manages GroupWise) - they should be able to help you get everything set up (or is that up set? ).
Reply With Quote
  #12  
Old 08-02-2006, 09:12 AM
flipside82 flipside82 is offline
Regular
 
Join Date: Nov 2003
Posts: 73
Default

I have my username and password for the smtp server, but I don't know where the code should be. Do I have it right in my code from the previous post? Or do I need to move it elsewhere? Do I have to do something with SSL?

Last edited by flipside82; 08-02-2006 at 09:59 AM.
Reply With Quote
  #13  
Old 08-03-2006, 07:02 AM
shaul_ahuvaSending Email with .Net Framework 2.0 and MAPI shaul_ahuva is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Jul 2003
Location: Camp Hill, PA
Posts: 1,992
Default

The code looks okay. What exact error are you getting?

Do you have to worry about SSL? Check to see if SSL is required by the SMTP server.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Sending Email with .Net Framework 2.0 and MAPI
Sending Email with .Net Framework 2.0 and MAPI
Sending Email with .Net Framework 2.0 and MAPI Sending Email with .Net Framework 2.0 and MAPI
Sending Email with .Net Framework 2.0 and MAPI
Sending Email with .Net Framework 2.0 and MAPI
Sending Email with .Net Framework 2.0 and MAPI Sending Email with .Net Framework 2.0 and MAPI Sending Email with .Net Framework 2.0 and MAPI Sending Email with .Net Framework 2.0 and MAPI Sending Email with .Net Framework 2.0 and MAPI Sending Email with .Net Framework 2.0 and MAPI Sending Email with .Net Framework 2.0 and MAPI
Sending Email with .Net Framework 2.0 and MAPI
Sending Email with .Net Framework 2.0 and MAPI
 
Sending Email with .Net Framework 2.0 and MAPI
Sending Email with .Net Framework 2.0 and MAPI
 
-->