473,387 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to send an email using C#.NET

103 100+
Hi Plator,

I am using c#.net..

Please help me to send mail using SMTP protocol and c#.net

Regards,
Mathew
Oct 8 '07 #1
3 1347
Frinavale
9,735 Expert Mod 8TB
Hi Mathew,

What have you tried so far to send a email using C#?

I've split your thread off of the .Net article on How to send an email using .NET. In the future please post new questions in the .Net Forum (Blue menu: Forums->.NET).

->Frinny
Oct 8 '07 #2
Plater
7,872 Expert 4TB
The process is the same as the VB.NET code given in the article, just the syntax needs to change over to C#.

Consider:
http://labs.developerfusion.co.uk/co...to-csharp.aspx
Oct 8 '07 #3
piercy
77
Hi Plator,

I am using c#.net..

Please help me to send mail using SMTP protocol and c#.net

Regards,
Mathew
something liek this i belive... (i cut this from my code, chopped it about a bit, so it may or may not work but the basis is there.)

Expand|Select|Wrap|Line Numbers
  1. using System.Web.Mail;
  2.  
  3. private void SendEmail(string contactemail, string fromemail, string subject, string message,string smtpip)
  4. {
  5. MailMessage objMsg = new MailMessage();
  6.  
  7.  
  8. objMsg.To = contactemail;
  9. objMsg.From = fromemail;
  10. objMsg.Subject = subject;
  11. objMsg.Body = message;
  12. //objMsg.Attachments.Add(attachment);
  13.  
  14. SmtpMail.SmtpServer = smtpip;
  15. SmtpMail.Send(objMsg);
  16. }
  17.  
pretty self explanatry, not sure how i did attachments, i think you just feed it the path of the file(ie. attachment variable).


Hope this helps.
Oct 9 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Gernot Hillier | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi! I'm the developer of a Linux ISDN application which uses embedded Python for controlling the communication. It starts several threads (i.e....
0
by: David Burson | last post by:
Hi, I have a VB.NET windows app that needs to automatically send a simple text email when my users run a new version of the app for the first time. I thought this would be simple, but after...
7
by: Randel Bjorkquist | last post by:
First, I'm extremely new to C# and the Microsoft Visual Studio IDE. I am in the middle of writing a small web application that communicates to a database server and sends out email confirmations. ...
9
by: Bob Jones | last post by:
We have developed a commercial ASP.net application (personal nutrition management and tracking); we want to send smtp email from within it. For our development box, we use WinXP Pro, IIS 5.5,...
2
by: Ron | last post by:
hi guys, I am trying to send email using smtpMail. I can send emails inside the organization, but out of the organization I get an error "The server rejected one or more recipient addresses. The...
1
by: Michele | last post by:
Hi, I need to send the same Email to different people. I'm using Outlook XP and VB.Net. I tryed with the following code: Dim oOutL As Outlook.Application Dim oMail As Outlook._MailItem oOutL...
14
by: supz | last post by:
Hi, I use the standard code given below to send an email from an ASP.NET web form. The code executes fine but no Email is sent. All emails get queued in the Inetpub mail queue. I'm using my...
8
by: shapper | last post by:
Hello, I am trying to send an email using Asp.Net 2.0. I am getting the following error: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: No such...
9
by: Mahernoz | last post by:
Can i send an email from JavaScript? Is it possible? If yes please the code to send email using javascript...
2
by: Malli mindwave | last post by:
Hi, We are using the yahoowebHostiing service for my company website, In that one screen of the SendComments/FeedBack section is there, I'm basically dot.net develeoper ,but yahoowebhosting not...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.