I made a windows form with a couple of text boxes. I want the user to click a send button and it automaticly sends it to my email without opening external programs such as outlook, etc. How would i do this?
Printable View
I made a windows form with a couple of text boxes. I want the user to click a send button and it automaticly sends it to my email without opening external programs such as outlook, etc. How would i do this?
you generally can't as there is no way to tell what mail they use, and if you can access their outgoing SMTP server to send email. Generally what I do in situations like this, is I would transmit data to a webpage, which would actually do the emailing, this way the only thing required of the end user is an internet connection. You pass the data using .net objects to the ASP or ASP.NET page, and it collects the data and emails it to you.
This solution requires that you have a webhost, and one that has an email activeX (or similar) control that allows sending email via code. Most .NET or ASP hosts do allow that.
what if you have a password and a username and every needed information about outgoing SMTP? is there a way to do it in vb.net?
yes.
check out the 101 vb.net examples (sticky at the top of the .net forum)
there is an example in there called "NET Framework - How-To Send Mail"
that should give you everything you need. Its a full example app.
Thanks buddy.
kleinma,
On my XP system, I was trying this example and found straight off that I don't have SMTP Service installed on my machine. Reading the Readme.htm, I try to find it by looking at Start | Control Panel | Administrative Tools | Internet Information Services, but I don't see Internet Information Services in Administrative Tools (perhaps hidden by our wonderful IT guys).
How can I find the info I need in order to get this example running?
EDIT: Looks like I may not have IIS installed according to this.
http://www.webwizguide.com/asp/tutor..._winXP_pro.asp
do you have windows XP Pro? if so its really easy to install IIS onto your system... if you DO NOT have Pro and have home, then it does not come with IIS
which do you have?
At the top of your form...
VB Code:
Imports System.Web.Mail
Put this in your event.
Subject is a string.
emaillist is a string
VB Code:
'Use SMTP Dim mail As New MailMessage With mail .To = EmailList .From = "[email protected]" .Subject = Subject .BodyFormat = MailFormat.Html .Body = Content .Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "25") 'Put port number here End With System.Threading.Thread.Sleep(200) SmtpMail.SmtpServer = "122.122.122.122" 'your real server goes here System.Threading.Thread.Sleep(200) SmtpMail.Send(mail)
XP Pro, but have no CD's. If still possible, please tell.Quote:
Originally Posted by kleinma
I can import System.Web, but Mail is not there? Using Help-About I have Microsoft Development Environment V 7.1.3088 and .NET Framework 1.1.4322. Does this mean I need a new version of Visual Studio .NET or Professional?Quote:
Originally Posted by dinosaur_uk
no you need to add a reference to system.web.dll in the .net references.Quote:
Originally Posted by fdunford
Also NO, without the XP Pro CD, you will not be able to install IIS, you also will not be able to create asp.net applications if you wanted to, because you need IIS to make it work correctly in VS.
I just call Blat when I want to send e-mail messages from a vb app. You can pass it both messages and attachments, and you can pass usernames and passwords as well, so you can send mail through ESMTP enabled servers.