Solved

VB.Net   -   Send Email

Posted on 2006-11-16
4
477 Views
Last Modified: 2008-02-26
VB.Net DeskTop Application
-------------------------------

I want to send Email   from  my DeskTop  Application (developed in VB.Net).

How can i do this. pls give some idea   or  code.
0
Comment
Question by:sohrabus
  • 2
  • 2
4 Comments
 
LVL 6

Expert Comment

by:bigphuckinglizard
ID: 17956271
you need to import the namespace System.Web.Mail

Dim Mail As New MailMessage(), strBody as String = ""
strBody &= "Hello" & vbcrlf
strBody &= "Goodbye"
With Mail
 .To = "you@whereyouare.com"
 .From = "me@whereiam.com"
 .Subject="Greetings!"
 .Body = strBody
End With      
SmtpMail.SmtpServer = "mail.yourdomain.com"
SmtpMail.Send(mail)
0
 

Author Comment

by:sohrabus
ID: 17962694
First , I would like to let u know that
System.Web.Mail          Namespace is not available in VB.Net DeskTop

This namespace is available when making appl. for web.
0
 
LVL 6

Accepted Solution

by:
bigphuckinglizard earned 125 total points
ID: 17963415
you need to go to project->add reference. whether it's a desktop or web application has no bearing on what namespaces are usable
0
 

Author Comment

by:sohrabus
ID: 17963751
Dear,

Thanks alot.

Ur code works fine.
I added reference   system.web.dll  and then imports namespace
system.web.mail.

Everything works fine.

Thanks,
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

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to dynamically set the form action using jQuery.

943 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

5 Experts available now in Live!

Get 1:1 Help Now