SlideShare a Scribd company logo
1 of 4
Download to read offline
POP3, MIME, FTP Send Email in ASP.NET
Learn In detail
https://way2educateu.blogspot.com/2017/02/pop3-mime-ftp-send-email-in-aspnet_99.html
Sending messages with ASP.NET Using POP3, MIME And FTP Servers is
quite straight forward. The .NET structure accompanies a whole
namespace for taking care of messages, the System.Net.Mail namespace.
In the accompanying illustrations, we will utilize two classes from this
namespace: The MailMessage class, for the real email, and the SmtpClient
class, for sending the email.
As you might know, sends are sent through a SMTP server, and to send
sends with the .NET system, you will require access to a SMTP server. In
case you're trying things locally, the organization that provisions your with
Internet get to, will typically have a SMTP server that you can utilize, and in
the event that you wish to utilize one of these cases on your genuine site,
the organization that has your site will normally have a SMTP server that
you can utilize. Experience the bolster pages to locate the real address -
it's normally something along the lines of smtp.your-isp.com or mail.your-
isp.com.
When you have an available SMTP server, we're prepared to send our first
email. For the main illustration, all you need is a void page, with the
accompanying code in the CodeBehind:
protected void Page_Load(object sender, EventArgs e)
{
try
{
MailMessage mailMessage = new MailMessage();
mailMessage.To.Add("your.own@mail-address.com");
mailMessage.From = new MailAddress("another@mail-
address.com");
mailMessage.Subject = "ASP.NET e-mail test";
mailMessage.Body = "Hello world,nnThis is an ASP.NET test e-
mail!";
SmtpClient smtpClient = new SmtpClient("smtp.your-isp.com");
smtpClient.Send(mailMessage);
Response.Write("E-mail sent!");
}
catch(Exception ex)
{
Response.Write("Could not send the e-mail - error: " + ex.Message);
}
}
That is quite you have to send an email. We make another MailMessage
occurrence, include another collector, set the "From" address and the
subject, and after that we compose a straightforward test message for the
body of the email. From that point forward, we make another occurrence of
the SmtpClient, with the host address of the SMTP server that you may use
as a parameter, and after that we utilize the SmtpClient case to shoot the
email out into the internet. The whole thing is encompassed by a try..catch
piece, just on the off chance that something turns out badly.
This was only an exceptionally essential illustration, yet there are a ton of
different choices. Here is a short rundown with fascinating thoughts:
You can join one or a few documents, essentially by adding them to the
Attachments accumulation
mailMessage.Attachments.Add(new
Attachment(Server.MapPath("~/image.jpg")));
You can send to more than one individual in the meantime, just by adding
another email deliver to the "To" gathering, this way:
mailMessage.To.Add("your.own@mail-address.com");
mailMessage.To.Add("another@mail-address.com");
You can set a name for the sender - something else, just the email address
will be appeared in the "From" section of the collectors email customer. For
example, similar to this:
mailMessage.From = new MailAddress("me@mail-address.com", "My
Name");
You can send HTML messages, rather than the default plaintext sends, to
utilize more confounded designs. Here is a straightforward illustration:
mailMessage.IsBodyHtml = true;
mailMessage.Body = "Hello <b>world!</b>";
You can utilize the CC and BCC fields, much the same as in consistent
email messages, this way:
mailMessage.CC.Add("me@mail-address.com");
mailMessage.Bcc.Add("me2@mail-address.com");
You can set the need of an email, this way:
mailMessage.Priority = MailPriority.High;

More Related Content

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Recently uploaded (20)

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Send Email In Asp.Net

  • 1. POP3, MIME, FTP Send Email in ASP.NET Learn In detail https://way2educateu.blogspot.com/2017/02/pop3-mime-ftp-send-email-in-aspnet_99.html Sending messages with ASP.NET Using POP3, MIME And FTP Servers is quite straight forward. The .NET structure accompanies a whole namespace for taking care of messages, the System.Net.Mail namespace. In the accompanying illustrations, we will utilize two classes from this namespace: The MailMessage class, for the real email, and the SmtpClient class, for sending the email. As you might know, sends are sent through a SMTP server, and to send sends with the .NET system, you will require access to a SMTP server. In case you're trying things locally, the organization that provisions your with Internet get to, will typically have a SMTP server that you can utilize, and in the event that you wish to utilize one of these cases on your genuine site, the organization that has your site will normally have a SMTP server that
  • 2. you can utilize. Experience the bolster pages to locate the real address - it's normally something along the lines of smtp.your-isp.com or mail.your- isp.com. When you have an available SMTP server, we're prepared to send our first email. For the main illustration, all you need is a void page, with the accompanying code in the CodeBehind: protected void Page_Load(object sender, EventArgs e) { try { MailMessage mailMessage = new MailMessage(); mailMessage.To.Add("your.own@mail-address.com"); mailMessage.From = new MailAddress("another@mail- address.com"); mailMessage.Subject = "ASP.NET e-mail test"; mailMessage.Body = "Hello world,nnThis is an ASP.NET test e- mail!"; SmtpClient smtpClient = new SmtpClient("smtp.your-isp.com"); smtpClient.Send(mailMessage); Response.Write("E-mail sent!"); } catch(Exception ex) { Response.Write("Could not send the e-mail - error: " + ex.Message); } } That is quite you have to send an email. We make another MailMessage occurrence, include another collector, set the "From" address and the subject, and after that we compose a straightforward test message for the body of the email. From that point forward, we make another occurrence of the SmtpClient, with the host address of the SMTP server that you may use as a parameter, and after that we utilize the SmtpClient case to shoot the
  • 3. email out into the internet. The whole thing is encompassed by a try..catch piece, just on the off chance that something turns out badly. This was only an exceptionally essential illustration, yet there are a ton of different choices. Here is a short rundown with fascinating thoughts: You can join one or a few documents, essentially by adding them to the Attachments accumulation mailMessage.Attachments.Add(new Attachment(Server.MapPath("~/image.jpg"))); You can send to more than one individual in the meantime, just by adding another email deliver to the "To" gathering, this way: mailMessage.To.Add("your.own@mail-address.com"); mailMessage.To.Add("another@mail-address.com"); You can set a name for the sender - something else, just the email address will be appeared in the "From" section of the collectors email customer. For example, similar to this: mailMessage.From = new MailAddress("me@mail-address.com", "My Name");
  • 4. You can send HTML messages, rather than the default plaintext sends, to utilize more confounded designs. Here is a straightforward illustration: mailMessage.IsBodyHtml = true; mailMessage.Body = "Hello <b>world!</b>"; You can utilize the CC and BCC fields, much the same as in consistent email messages, this way: mailMessage.CC.Add("me@mail-address.com"); mailMessage.Bcc.Add("me2@mail-address.com"); You can set the need of an email, this way: mailMessage.Priority = MailPriority.High;