Ernes
Tech
Register
Login
AI
Search
News
Articles
Videos
1
Home
Articles
Details
+1 888-688-2939
[email protected]
How to use a Text File as a Template to Send Email in dotnet core 2
Login to See the Rest of the Answer
Answer:
One way to accomplish this is by creating a text file and defining your template wrapped in a pair of double hash symbols
For Example:
Name: ##Name##
E-Mail Address: ##Email##
Home Phone: ##Phone##
Comments: ##Comments##
After you create a text file in your project and have typed your template as shown in 2, then you would write your C# code like this;
using System.IO // For reading the file
using System.Net.Mail //Sending the Email
//First read the file
string myFile = Server.MapPath("~/App_Directory/YourTextFileName.txt");
string mailBody = File.ReadAllText(myFile);
mailBody = mailBody.Replace("##Name##","Jack");
mailBody = mailBody.Replace("##E-Mail Address##","
[email protected]
");
Go on and implement this until you see fit.
#Technology
.Net 7
published
v.0.01
Notify Me of New Posts
×
We Recieved Your Request. Thank you.
We'll never share your email with anyone else.
Submit
You Liked This Article
Post Comment
How to Use a well Known Drawing Method to Achieve
How to Use a well Known Drawing Method to Achieve Realism in Drawing
ART
Read Article
Dotnet 8 publishing Self-Contained Application not
Dotnet 8 publishing Self-Contained Application not Working
OTHER
Read Article
How to read an Email Header
How to read an Email Header
RESEARCH
Read Article
How to Use 2 CTE in a Single SQL Query - Use Temp
How to Use 2 CTE in a Single SQL Query - Use Temp Table Instead
SQL
Read Article
How to Remove Duende IdentityServer from Blazor We
How to Remove Duende IdentityServer from Blazor Web Assembly Application in Visual Studio 2022
.NET 7
Read Article
How to Prepare a Reference Photo for Drawing
How to Prepare a Reference Photo for Drawing
ART
Read Article
Vmware ESXI 6.2 How to Mount a USB Storage to vmwa
Vmware ESXI 6.2 How to Mount a USB Storage to vmware esxi host
HARDWARE
Read Article
How to use a Text File as a Template to Send Email
How to use a Text File as a Template to Send Email in C#
TECHNOLOGY
Read Article
Asp.Net 5 Development Notes (DotNet Core 3.1 Study
Asp.Net 5 Development Notes (DotNet Core 3.1 Study Notes)
SOFTWARE DEVELOPMENT
Read Article
How you parse a collection of email addresses with
How you parse a collection of email addresses with mimekit?
TECHNOLOGY
Read Article
MSB1009: Docker File Error when building Asp.Net 5
MSB1009: Docker File Error when building Asp.Net 5
.NET 7
Read Article
How to Bind a CheckBox data to a Model Integer Pro
How to Bind a CheckBox data to a Model Integer Property in DotNet Core 2.2
DATABASES
Read Article
[Resolved] Dot Net Core Error "Project file is inc
[Resolved] Dot Net Core Error "Project file is incomplete. Expected imports are missing"
.NET 7
Read Article
MSBUILD : error MSB1009: Project file does not exi
MSBUILD : error MSB1009: Project file does not exist. Switch: ProjectName.csproj
.NET 7
Read Article
Top
© 2024 - ErnesTech -
Privacy
E-Commerce Return Policy
+1 (216)-435-0788
[email protected]
For peering opportunity
Autonomouse System Number:
AS401345
[email protected]
English (United States)
Spanish (Spain)
French (France)
Portuguese (Brazil)
Chinese (China)
Turkish (Turkey)
German (Germany)
Jobs
Search
CRM
Articles
Videos
Shop
Contact
Sign Up
Login
Grid-Method Tools
PDF to HTML Converter
Forums