473,473 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Create 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 2823
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.SmtpServer = "smtp.foo.net";
MailMessage mail = new MailMessage();
mail.To = "he**@foosoft.com";
mail.From = custEmail.Text;
mail.Subject = "Request";
mail.Body = custName.Text + "\n\n" + custPhone.Text + "\n\n" +
custDescription.Text;

SmtpMail.Send(mail);

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.SmtpServer = "smtp.foo.net";
MailMessage mail = new MailMessage();
mail.To = "he**@foosoft.com";
mail.From = custEmail.Text;
mail.Subject = "Request";
mail.Body = custName.Text + "\n\n" + custPhone.Text + "\n\n" +
custDescription.Text;

SmtpMail.Send(mail);

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.SmtpServer = "smtp.foo.net";
MailMessage mail = new MailMessage();
mail.To = "he**@foosoft.com";
mail.From = custEmail.Text;
mail.Subject = "Request";
mail.Body = custName.Text + "\n\n" + custPhone.Text + "\n\n" +
custDescription.Text;

SmtpMail.Send(mail);

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.SmtpServer = "smtp.foo.net";
MailMessage mail = new MailMessage();
mail.To = "he**@foosoft.com";
mail.From = custEmail.Text;
mail.Subject = "Request";
mail.Body = custName.Text + "\n\n" + custPhone.Text + "\n\n" +
custDescription.Text;

SmtpMail.Send(mail);

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.SmtpServer = "smtp.foo.net";
MailMessage mail = new MailMessage();
mail.To = "he**@foosoft.com";
mail.From = custEmail.Text;
mail.Subject = "Request";
mail.Body = custName.Text + "\n\n" + custPhone.Text + "\n\n" +custDescription.Text;

SmtpMail.Send(mail);

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.SmtpServer = "smtp.foo.net";
MailMessage mail = new MailMessage();
mail.To = "he**@foosoft.com";
mail.From = custEmail.Text;
mail.Subject = "Request";
mail.Body = custName.Text + "\n\n" + custPhone.Text + "\n\n" +custDescription.Text;

SmtpMail.Send(mail);

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
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...
4
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...
3
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...
4
by: Kurien Baker Fenn | last post by:
How to send data from an ASP form to a visual basic form? Please help
13
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...
10
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...
2
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...
15
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...
4
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...
1
by: yusufjammy | last post by:
how to send mail with visual basic 2008 to gmail id.
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.