[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Auto se3nding email in VB.NET

Posted on 2006-05-01
4
Medium Priority
?
189 Views
Last Modified: 2010-04-23
I have a need to automatically send an email from my Windows VB.net form.  Note that this is not a web form (aspx).

In ASP.NET I can use  a SmtpMail.Send(Message) command.  What do I have to do similarily in a VB.Net windows form?

Rob
0
Comment
Question by:robertjmackay
  • 2
  • 2
4 Comments
 
LVL 7

Expert Comment

by:wtconway
ID: 16577552
The same way. Like so:

            Dim eml As New MailMessage
            eml.To = "everybody@world.com"
            eml.From = "billgates@microsoft.com"
            eml.Subject = "Free money!"
            eml.Body = "He should give us all a dollar."

            Dim smtp As SmtpMail
            smtp.SmtpServer = "mydomain.com"
            smtp.Send(eml)
0
 

Author Comment

by:robertjmackay
ID: 16577618
When I added the imports system.web.mail statement, I get a compiler error.  Am I missing something
0
 
LVL 7

Accepted Solution

by:
wtconway earned 1000 total points
ID: 16577644
I've noticed this issue too. Try this:

In your References (Solution Explorer), make sure System.Web is added. If not, right click References, Add Reference, scroll down to System.Web.

Tell me what happens.
0
 

Author Comment

by:robertjmackay
ID: 16578444
well done, thanks

Rob MacKay
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

872 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