Solved

VB.Net   -   Send Email

Posted on 2006-11-16
4
476 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Uploading files to the web server has become common part of almost any kind of web application. People use different technologies to solve this, but regardless of the technology used, it is always useful to have some kind of progress indicator shown…
Problem to be resolved in this article Currently, development of website and web application can be done without writing thousands of lines of programming code by hand. Description This can be done through by using a open source framework such …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

758 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

23 Experts available now in Live!

Get 1:1 Help Now