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
Guest User
Tech Writer
18
2.9k
Send Email By Send Grid,
Mar 25 2021 11:46 AM
I have made a code using send gird api for send email.My email successfully send but i want to my email with proper format .
Please help me.
var client =
new
SendGridClient(apiKey);
var msg =
new
SendGridMessage()
{
From =
new
EmailAddress(
"
[email protected]
"
),
Subject = subject,
PlainTextContent = htmlContent,
HtmlContent = htmlContent
};
msg.AddTo(
new
EmailAddress(toEmail));
var response = await client.SendEmailAsync(msg); --
this
is
my c# code
this jquery and html code
I have made a code using send gird api
for
send email.My email successfully send but i want to my email
with
proper format .
Please help me.
var
client =
new
SendGridClient(apiKey);
var
msg =
new
SendGridMessage()
{
From =
new
EmailAddress(
"
[email protected]
"
),
Subject = subject,
PlainTextContent = htmlContent,
HtmlContent = htmlContent
};
msg.AddTo(
new
EmailAddress(toEmail));
var
response = await client.SendEmailAsync(msg); --
this
is my c# code
this
jquery and html code
<div
class
=
"contact-main"
>
<div
class
=
"container"
>
<div
class
=
"row"
>
<div
class
=
"col-md"
>
<div
class
=
"back-shadow-contact "
>
<h2>Get
in
Touch</h2>
<form id=
"form"
>
<div
class
=
"form-row"
>
<div
class
=
"form-group col-md-6"
>
<input type=
"email"
class
=
"form-control form-contact"
id=
"htmlContent"
placeholder=
"Your Name"
required=
"required"
/>
</div>
<div
class
=
"form-group col-md-6"
>
<input type=
"text"
class
=
"form-control form-contact"
id=
"toEmail"
placeholder=
"Your Email Address"
required />
</div>
</div>
<div
class
=
"form-row"
>
<div
class
=
"form-group col-md-6"
>
<input type=
"text"
class
=
"form-control form-contact"
id=
"subject"
placeholder=
"Subject"
required />
</div>
<div
class
=
"form-group col-md-6"
>
<input type=
"text"
class
=
"form-control form-contact"
id=
"contact"
placeholder=
"Your Contact No."
required />
</div>
</div>
<div
class
=
"form-group"
>
<textarea
class
=
"form-control form-contact-msg"
rows=
"5"
id=
"htmlContent"
placeholder=
"Enter Your Message"
required></textarea>
</div>
<button
class
=
"submit-contact"
type=
"button"
id=
"btnSend"
>Submit</button>
</form>
</div>
</div>
</div>
</div>
</div>
<div>
</div>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"
></script>
<script type=
"text/javascript"
>
$(
function
() {
$(
"#btnSend"
).click(
function
(e) {
e.preventDefault();
var
record = {
"htmlContent"
: $(
"#htmlContent"
).val(),
"toEmail"
: $(
"#toEmail"
).val(),
"subject"
: $(
"#subject"
).val(),
"htmlContent"
: $(
"#htmlContent"
).val(),
"contact"
: $(
"#contact"
).val(),
};
$.ajax({
url:
'/Genric/SendMail'
,
type:
"GET"
,
data: record,
contentType:
"application/json; charset=utf-8"
,
success:
function
() {
$(
"#form"
).reset();
},
error:
function
() {
},
failure:
function
() {
}
});
});
});
</script>
My result is
Demo
Inbox
info@
4:19 PM (56 minutes ago)
to
me
Demo -not here UserName
Reply
Answers (
2
)
Send Data By Ajax.
Get fieldByName Sage300 accpac session