Getting VB.NET to email you...
Getting VB.NET to email you...
Getting VB.NET to email you...
Getting VB.NET to email you...
Getting VB.NET to email you...
Getting VB.NET to email you... Getting VB.NET to email you... Getting VB.NET to email you... Getting VB.NET to email you... Getting VB.NET to email you... Getting VB.NET to email you... Getting VB.NET to email you... Getting VB.NET to email you...
Getting VB.NET to email you... Getting VB.NET to email you...
Getting VB.NET to email you...
Go Back  Xtreme Visual Basic Talk > > > Getting VB.NET to email you...


Reply
 
Thread Tools Display Modes
  #1  
Old 01-19-2005, 08:18 AM
garcon garcon is offline
Freshman
 
Join Date: Dec 2004
Posts: 38
Default Getting VB.NET to email you...


Folks,

Can you get VB.NET to email you? There is a part in my code that if it occurs I would like the s/w to email me with a notification.
I have the application on my box which has the IIS server on it and Microsoft Outlook mailer.

Comments/suggestions/code-samples/things that I should be aware of much appreciated.

Thanking you
G.
Reply With Quote
  #2  
Old 01-19-2005, 08:33 AM
AFterlife's Avatar
AFterlife AFterlife is offline
Contributor
 
Join Date: Dec 2003
Location: Mi
Posts: 654
Default

Quote:
Originally Posted by garcon
Folks,

Can you get VB.NET to email you? There is a part in my code that if it occurs I would like the s/w to email me with a notification.
I have the application on my box which has the IIS server on it and Microsoft Outlook mailer.

Comments/suggestions/code-samples/things that I should be aware of much appreciated.

Thanking you
G.
You need imports System.Web.Mail at the top of the class

then you need
Code:
Dim myMessage As New MailMessage myMessage.To = txtTO.Text myMessage.From = txtFROM.Text myMessage.Body = txtBody.Text SmtpMail.SmtpServer = "yoursmtpserverhere" SmtpMail.Send(myMessage)

Thats a really simple example. You can also do attachments.Also the to and from need to be an e-mail address.
Reply With Quote
  #3  
Old 01-19-2005, 10:11 AM
garcon garcon is offline
Freshman
 
Join Date: Dec 2004
Posts: 38
Default

merci
Reply With Quote
  #4  
Old 03-05-2005, 11:19 AM
douglasbirbeck douglasbirbeck is offline
Freshman
 
Join Date: Sep 2004
Posts: 44
Default

hi, i tried to put imports System.Web.Mail at the top of the class, but i get an error 'namespace or type 'mail' for the imports 'system.web.mail' could not be found. can you please tell me how to sort this out ? thanks
__________________
former COBOL freelancer
Reply With Quote
  #5  
Old 03-05-2005, 11:38 AM
AFterlife's Avatar
AFterlife AFterlife is offline
Contributor
 
Join Date: Dec 2003
Location: Mi
Posts: 654
Default

You used the imports as the very first thing at the top of your form class?

You also need to add a reference to the System.Web.dll
Reply With Quote
  #6  
Old 03-05-2005, 11:42 AM
douglasbirbeck douglasbirbeck is offline
Freshman
 
Join Date: Sep 2004
Posts: 44
Default

Quote:
Originally Posted by AFterlife
You used the imports as the very first thing at the top of your form class?
hi, thanks for replying. yes, i put it at the top. i just noticed that you need windows xp prosessional as a requirement and i've only got the home version. could that be it ?
__________________
former COBOL freelancer
Reply With Quote
  #7  
Old 03-05-2005, 11:43 AM
AFterlife's Avatar
AFterlife AFterlife is offline
Contributor
 
Join Date: Dec 2003
Location: Mi
Posts: 654
Default

That shouldnt matter. Please re-read my previous post as I edited it.
Reply With Quote
  #8  
Old 03-05-2005, 11:48 AM
douglasbirbeck douglasbirbeck is offline
Freshman
 
Join Date: Sep 2004
Posts: 44
Default

Quote:
Originally Posted by AFterlife
That shouldnt matter. Please re-read my previous post as I edited it.
thanks afterlife, that was it, the reference i didn't know about. i've never sent email from vb before and this automatic emailing is critical to the system i am writing. thanks again, the code should be ok now!!!
__________________
former COBOL freelancer
Reply With Quote
  #9  
Old 03-05-2005, 11:59 AM
AFterlife's Avatar
AFterlife AFterlife is offline
Contributor
 
Join Date: Dec 2003
Location: Mi
Posts: 654
Default

Np's. Just know that the txt prefixes are textboxes and the from and to need to be an e-mail address. Not a name.
Reply With Quote
  #10  
Old 03-05-2005, 12:07 PM
douglasbirbeck douglasbirbeck is offline
Freshman
 
Join Date: Sep 2004
Posts: 44
Default

well i've just sent my first email and it worked great. thanks again. in the system i'm writing, i want to give the users plenty of options for using their preferred email, which may be a web based email system. any idea how to send emails via yahoo or hotmail ??
__________________
former COBOL freelancer
Reply With Quote
  #11  
Old 03-05-2005, 12:23 PM
AFterlife's Avatar
AFterlife AFterlife is offline
Contributor
 
Join Date: Dec 2003
Location: Mi
Posts: 654
Default

Nope.
Reply With Quote
  #12  
Old 03-05-2005, 02:28 PM
akrocks's Avatar
akrocks akrocks is offline
Junior Contributor
 
Join Date: Mar 2003
Location: the great plains...
Posts: 398
Default

Quote:
Originally Posted by douglasbirbeck
any idea how to send emails via yahoo or hotmail ??
just look up on their site and find their info on how to read email in outlook and other clients. yahoo's is prolly something like smtp.mail.yahoo.com or something.
Reply With Quote
  #13  
Old 03-10-2005, 05:08 AM
ArawnBlack ArawnBlack is offline
Newcomer
 
Join Date: Mar 2005
Posts: 2
Default

hrmm a quick question or 2 from the newbie programmer:

Preface: I am a VERY new programmer
1. I replaced the To and From fields with teh email address, but vb.net won't allow the email address to stand it keeps seperating the email address is there something I am missing?

Dim myMessage As New MailMessage()
myMessage.To = txtTO.Text <---- in this line here
myMessage.From = txtFROM.Text
myMessage.Body = txtBody.Text
SmtpMail.SmtpServer = "yoursmtpserverhere"
SmtpMail.Send(myMessage)

If I were going to use me@fuse.net how should it look?

Last edited by ArawnBlack; 03-10-2005 at 05:54 AM.
Reply With Quote
  #14  
Old 03-10-2005, 08:06 AM
douglasbirbeck douglasbirbeck is offline
Freshman
 
Join Date: Sep 2004
Posts: 44
Default

Quote:
Originally Posted by AFterlife
You used the imports as the very first thing at the top of your form class?

You also need to add a reference to the System.Web.dll
did you do this ??
__________________
former COBOL freelancer
Reply With Quote
  #15  
Old 03-10-2005, 08:06 AM
AFterlife's Avatar
AFterlife AFterlife is offline
Contributor
 
Join Date: Dec 2003
Location: Mi
Posts: 654
Default

Wrap the address in "qoutes".
Reply With Quote
  #16  
Old 03-12-2005, 04:46 AM
ArawnBlack ArawnBlack is offline
Newcomer
 
Join Date: Mar 2005
Posts: 2
Default

thanks guys, I did get the system.web.dll thingy but I just learned the string vs char thing.... thanks again
Reply With Quote
  #17  
Old 03-16-2005, 09:00 PM
skyrender skyrender is offline
Newcomer
 
Join Date: Nov 2004
Posts: 18
Talking e-mail through VB, wow!

I'm also developing an application which needs to be able to both Send and recieve e-mail messages. How is it that I could configure a .NET application to recieve an e-mail? Thanks!
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
Getting VB.NET to email you...
Getting VB.NET to email you...
Getting VB.NET to email you... Getting VB.NET to email you...
Getting VB.NET to email you...
Getting VB.NET to email you...
Getting VB.NET to email you... Getting VB.NET to email you... Getting VB.NET to email you... Getting VB.NET to email you... Getting VB.NET to email you... Getting VB.NET to email you... Getting VB.NET to email you...
Getting VB.NET to email you...
Getting VB.NET to email you...
 
Getting VB.NET to email you...
Getting VB.NET to email you...
 
-->