473,946 Members | 28,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to send mail from Visual Basic .Net Windows App

Hi,
I am trying to send Mail from VB.net app but I can not do
it. Even I can not do this = Imports system.mail, the mail
option is not available. I also have to do more then one
atachements. Some one please help.

Thanks,
mashraf

Nov 22 '05 #1
6 2855
Mahsraf,

You need to include System.Web.Mail . Then you can create and populate a
MailMessage object and send it using the system SmtpServer object.
Here's a C# code snippet of mine. The VB is quite similar.

--mark richter

using System.Web.Mail ;
..
..
..
SmtpMail.SmtpSe rver = "smtp.foo.n et";
MailMessage mail = new MailMessage();
mail.To = "he**@foosoft.c om";
mail.From = custEmail.Text;
mail.Subject = "Request";
mail.Body = custName.Text + "\n\n" + custPhone.Text + "\n\n" +
custDescription .Text;

SmtpMail.Send(m ail);

mashraf wrote:
Hi,
I am trying to send Mail from VB.net app but I can not do
it. Even I can not do this = Imports system.mail, the mail
option is not available. I also have to do more then one
atachements. Some one please help.

Thanks,
mashraf


Nov 22 '05 #2
Mahsraf,

You need to include System.Web.Mail . Then you can create and populate a
MailMessage object and send it using the system SmtpServer object.
Here's a C# code snippet of mine. The VB is quite similar.

--mark richter

using System.Web.Mail ;
..
..
..
SmtpMail.SmtpSe rver = "smtp.foo.n et";
MailMessage mail = new MailMessage();
mail.To = "he**@foosoft.c om";
mail.From = custEmail.Text;
mail.Subject = "Request";
mail.Body = custName.Text + "\n\n" + custPhone.Text + "\n\n" +
custDescription .Text;

SmtpMail.Send(m ail);

mashraf wrote:
Hi,
I am trying to send Mail from VB.net app but I can not do
it. Even I can not do this = Imports system.mail, the mail
option is not available. I also have to do more then one
atachements. Some one please help.

Thanks,
mashraf


Nov 22 '05 #3
Mahsraf,

You need to include System.Web.Mail . Then you can create and populate a
MailMessage object and send it using the system SmtpServer object.
Here's a C# code snippet of mine. The VB is quite similar.

--mark richter

using System.Web.Mail ;
..
..
..
SmtpMail.SmtpSe rver = "smtp.foo.n et";
MailMessage mail = new MailMessage();
mail.To = "he**@foosoft.c om";
mail.From = custEmail.Text;
mail.Subject = "Request";
mail.Body = custName.Text + "\n\n" + custPhone.Text + "\n\n" +
custDescription .Text;

SmtpMail.Send(m ail);

mashraf wrote:
Hi,
I am trying to send Mail from VB.net app but I can not do
it. Even I can not do this = Imports system.mail, the mail
option is not available. I also have to do more then one
atachements. Some one please help.

Thanks,
mashraf


Nov 22 '05 #4
Mahsraf,

You need to include System.Web.Mail . Then you can create and populate a
MailMessage object and send it using the system SmtpServer object.
Here's a C# code snippet of mine. The VB is quite similar.

--mark richter

using System.Web.Mail ;
..
..
..
SmtpMail.SmtpSe rver = "smtp.foo.n et";
MailMessage mail = new MailMessage();
mail.To = "he**@foosoft.c om";
mail.From = custEmail.Text;
mail.Subject = "Request";
mail.Body = custName.Text + "\n\n" + custPhone.Text + "\n\n" +
custDescription .Text;

SmtpMail.Send(m ail);

mashraf wrote:
Hi,
I am trying to send Mail from VB.net app but I can not do
it. Even I can not do this = Imports system.mail, the mail
option is not available. I also have to do more then one
atachements. Some one please help.

Thanks,
mashraf


Nov 22 '05 #5
Thanks Mark,
I did not refrence the mail class. Your code snipet worked
fine. Thanks again.
Mashraf
-----Original Message-----
Mahsraf,

You need to include System.Web.Mail . Then you can create and populate aMailMessage object and send it using the system SmtpServer object.Here's a C# code snippet of mine. The VB is quite similar.

--mark richter

using System.Web.Mail ;
..
..
..
SmtpMail.SmtpSe rver = "smtp.foo.n et";
MailMessage mail = new MailMessage();
mail.To = "he**@foosoft.c om";
mail.From = custEmail.Text;
mail.Subject = "Request";
mail.Body = custName.Text + "\n\n" + custPhone.Text + "\n\n" +custDescriptio n.Text;

SmtpMail.Send(m ail);

mashraf wrote:
Hi,
I am trying to send Mail from VB.net app but I can not do it. Even I can not do this = Imports system.mail, the mail option is not available. I also have to do more then one atachements. Some one please help.

Thanks,
mashraf


.

Nov 22 '05 #6
Thanks Mark,
I did not refrence the mail class. Your code snipet worked
fine. Thanks again.
Mashraf
-----Original Message-----
Mahsraf,

You need to include System.Web.Mail . Then you can create and populate aMailMessage object and send it using the system SmtpServer object.Here's a C# code snippet of mine. The VB is quite similar.

--mark richter

using System.Web.Mail ;
..
..
..
SmtpMail.SmtpSe rver = "smtp.foo.n et";
MailMessage mail = new MailMessage();
mail.To = "he**@foosoft.c om";
mail.From = custEmail.Text;
mail.Subject = "Request";
mail.Body = custName.Text + "\n\n" + custPhone.Text + "\n\n" +custDescriptio n.Text;

SmtpMail.Send(m ail);

mashraf wrote:
Hi,
I am trying to send Mail from VB.net app but I can not do it. Even I can not do this = Imports system.mail, the mail option is not available. I also have to do more then one atachements. Some one please help.

Thanks,
mashraf


.

Nov 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
18539
by: Samia | last post by:
I have an application running on a single workstation (win 2000) with Outlook installed and a profile create using and exchange server with authentification through the DNS. This user profile is the only one using the app. I want the app to send email using the profile's email adress. Here is what I am doing : Dim mail As New MailMessage()
4
4346
by: CK | last post by:
Hi all, I know this question is stupid. But i need some advice for this. I am trying to develop a website, which will allow the user send to order form to the admin email. I am planning to use the CDONTS component method. Can I just to localhost server to test, whether the form can be send up to the admin's email. Or I must have the Hosting server to do that. Can Anyone suggest me, how to I test my scripts can be successfully run (at...
3
376
by: mashraf | last post by:
Hi, I am trying to send Mail from VB.net app but I can not do it. Even I can not do this = Imports system.mail, the mail option is not available. I also have to do more then one atachements. Some one please help. Thanks, mashraf
4
1937
by: Kurien Baker Fenn | last post by:
How to send data from an ASP form to a visual basic form? Please help
13
7550
by: MLH | last post by:
I want to send 2 reports using SendObject. Something like this would do nicely... DoCmd SendObject A_REPORT, "rpt1";"rpt2", A_FORMATRTF, MyRecip, , , MySubject, MyBodyText, 0 ....except for the fact that this syntax won't compile. Suggestions?
10
11235
by: Dennis | last post by:
I am trying to send an e-mail using one of the examples I got on this group as follows: (both toemail and myemail are valid e-mail addreses. 'System.Web.Mail' (requires reference to "System.Web.dll"), ''' delcare a new mail message Dim aMailMessage As New System.Web.Mail.MailMessage ''' set the from address aMailMessage.From = myemail ''' set the to address and subject
2
1445
by: Walter CF | last post by:
Hi, I develop an application that send mail using system.web.mail namespace, It work without problems over Windows Xp, but in windows 98 it dont't work, I've read from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebmailsmtpmailclasstopic.asp requirements to this Namespace CDOsys.dll or CDONTS.dll and windows 2000,Xp,NT. does it mean that my app will not send e-mails from a Win98 client? is there...
15
8611
by: cj | last post by:
How can I get a button in VB to send the contents of a text box via email in a manner similar to the "Send To\Mail Recipient" functionality that you can select via right clicking a file in Windows Explorer? I want the user to click a button and it lunch the users default email client and put the contents of a multi line text box in the body of the message and the contents of another text box in the title box and be sitting there read for...
4
1267
by: mse07 | last post by:
hi for everyone if i send e-mail by visual basic from outlook , before outlook complete sending the message it shows message box contain following text : A program is trying to automatically send e-mail on your behalf.
1
1655
by: yusufjammy | last post by:
how to send mail with visual basic 2008 to gmail id.
0
10149
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11548
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11140
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8239
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4927
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4520
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3523
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.