Solved

VB.Net   -   Send Email

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
When should I use a controller? 3 40
Shopping Cart 2 83
How to create a textarea which saves text in HTML 8 47
Code Manager | Snippits 2 36
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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 is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

856 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