开发者

MvcMailer: trying to send email to one static recipient and Email (in model and view as a text input)

Sorry for the SQOTD:

Using MvcMailer. I created a quote system, wherein users inputs determines pricing. Based on user inputs, an email is generated with a quote. I want to send that e-mail to the "Email" address the user input as well as to myself.

In my Mailer.cs I have

mailMessage.To.Add("some-email@example.com");

I want that static e-mail so that I can send myself the quote.

But how can I also send the e-mail to the "Email" the user input in the for开发者_StackOverflowm?

My model has:

public string Email { get; set; }

My form (view) has:

@Html.TextBoxFor(m => m.Email)

Thanks for any help.


You could use the Bcc field (recipient will not see the other email):

mailMessage.To.Add("some-email@example.com");
mailMessage.Bcc.Add(model.Email);

or the CC (recipient will see the other email).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜