TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Marius Vasile
594
1.9k
144.7k
asp.net core contact form add multiple data in message body
Mar 6 2021 3:44 PM
I am using this to send email from contact form
var message =
new
MimeMessage();
message.From.Add(
new
MailboxAddress(_smtpSettings.SenderName, _smtpSettings.SenderEmail));
message.To.Add(
new
MailboxAddress(
"
[email protected]
"
));
message.Subject =
"Contact form communication"
;
message.Body =
new
TextPart(
"html"
)
{
Text =
"test message"
};
using
(var client =
new
SmtpClient())
{
await client.ConnectAsync(_smtpSettings.Server, _smtpSettings.Port,
true
);
client.AuthenticationMechanisms.Remove(
"XOAUTH2"
);
await client.AuthenticateAsync(_smtpSettings.UserName, _smtpSettings.Password);
await client.SendAsync(message);
await client.DisconnectAsync(
true
);
}
which is working very well. But the body text I want to contain concatenated values from form
Text = ContactForm.Name + ContactForm.Email + ContactForm.Company + ContactForm.Message
Reply
Answers (
7
)
C# mvc Html and css are not connecting
Avoid postback on linkbutton of content page.