Questions tagged [mailmessage]

The MailMessage class can be considered the foundation class of the System.Net.Mail namespace.

The MailMessage class can be considered the foundation class of the System.Net.Mail namespace.

Instances of the MailMessage class are used to construct e-mail messages that are transmitted to an SMTP server for delivery using the SmtpClient class.

The sender, recipient, subject, and body of an e-mail message may be specified as parameters when a MailMessage is used to initialize a MailMessage object. These parameters may also be set or accessed using properties on the MailMessage object.

The MailMessage class also allows an application to access the headers collection for the message using the Headers property. While this collection is read-only (a new collection can not be set), custom headers can be added to or deleted from this collection.

344 questions
4
votes
1 answer

MailDefinition/MailMessage and basepath cannot be null

I'm creating a MailMessage with the code below and I'm receiving this error when calling mail.CreateMailMessage. Value cannot be null. Parameter name: basepath Anyone know what could be wrong? public void SendReciept(string reciever) { …
Misbit
  • 347
  • 2
  • 20
4
votes
1 answer

MailMessage - Error Opening Attachment

I am using NPOI to create an excel workbook and attempting to send it as an attachment in an email. My code is as follows: var wb = new HSSFWorkbook(); //create the workbook using(var ms = new MemoryStream()) { wb.Write(ms); var msg = new…
aw04
  • 10,857
  • 10
  • 56
  • 89
4
votes
1 answer

Generating a view without a controller in MVC?

My application is split into three tiers: View (MVC) Business logic (Services) Data (LINQ / SQL) Throughout my Services layer, I have calls to an EmailSender service that currently sends plaintext emails via SmtpClient and MailMessage. Pretty…
RobVious
  • 12,685
  • 25
  • 99
  • 181
4
votes
1 answer

Web Server is Sending Duplicate E-Mails

For every e-mails that my website sends I have it send myself an email as well. I noticed that about 5% of the e-mails (Thousands a day) are being sent twice. The time between the duplicates being sent however is completely inconsistent...Can be a…
mmcclur2
  • 41
  • 1
  • 3
4
votes
2 answers

Delete An Outlook Appointment Created Using C# And Updating Category of Outlook

I have created appointment using the below code: MailMessage mmMessage = new MailMessage(); System.Net.Mime.ContentType typeCalendar = new System.Net.Mime.ContentType("text/calendar"); // Add parameters to the calendar…
Ruchi
  • 1,238
  • 11
  • 32
3
votes
3 answers

sending mails using MailMessage class - Limitations OF BCC and CC counts?

i have a list (1,000,000 emails addresses) of my customers and i want to send them an specific email (all of those emails are the same) using MailMessage calss. is there any limitation(s) about Ensemble Emails using this class or global rules about…
SilverLight
  • 19,668
  • 65
  • 192
  • 300
3
votes
0 answers

c# MailMessage From email address display name is not working

I tried to send an email and set display name of the from Email address. But when i received email in my client for instance gmail. Instead of display name i see email address without domain means From Email "FromEmail@abc.com" then when i received…
3
votes
1 answer

ASP.NET MailMessage.BodyEncoding and MailMessage.SubjectEncoding defaults

Simple question but I can't find the answer anywhere on MSDN... Looking for the defaults ASP.NET will use for: MailMessage.BodyEncoding and MailMessage.SubjectEncoding If you don't set them in code? Thanks
timothyclifford
  • 6,799
  • 7
  • 57
  • 85
3
votes
2 answers

How can I send MailMessages using multiple threads?

I hope you guys will bear with me for my total lack of direction in case of Threading. I have to implement a Mail Queue Processing System where I have to send emails queued up in a database through a Windows Service. It is not a producer-consumer…
Pankaj Kumar
  • 1,748
  • 6
  • 28
  • 41
3
votes
1 answer

Notification Images cannot be found when triggered by an command/schedule

When I trigger a notification via a controller the MailMessage sends with no issue, all imaged contained. However when the same notification is triggered via a schedule item that calls a console command the images cannot be found.
James Wolfe
  • 340
  • 5
  • 18
3
votes
1 answer

Serialize a FileStream for transport

See also this question: Can I pass a System.Net.MailMessage to a WCF service? I'd like to add attachments to the mail being sent. Attachments are either files on the local disc, or dynamically created Streams. A WCF contract can contain a Stream,…
edosoft
  • 17,121
  • 25
  • 77
  • 111
3
votes
1 answer

Can I pass a System.Net.MailMessage to a WCF service?

I'd like to setup a WCF service to send emails. The System.Net.MailMessage doesn't seem to be serializable, and cannot be passed in a [DataContract] The error I receive is Type 'System.Net.Mail.MailAddress' cannot be serialized. Consider…
edosoft
  • 17,121
  • 25
  • 77
  • 111
3
votes
1 answer

MailMessage object is received empty at MVC Web API post method

I'm quite new to MVC and Web API. I'm trying to post a MailMessage(System.Net.Mail) object to the web api that I've created but the object is received as empty at API. I'm using ReshSharp to call the api below is my code: MailMessage myMail = new…
Rakesh
  • 51
  • 4
3
votes
2 answers

file attachment form c#

I'm creating a web form that requires an user to upload a file in doc, docx or pdf format. On submit, the form gets posted to an email address along with the attached file. I have successfully implemented the posting of the form to the email address…
Rafay
  • 30,950
  • 5
  • 68
  • 101
3
votes
1 answer

Calendar Invite with HTML body that contains images

I am having trouble getting my images to display as part of the HTML body of a mailmessage that also contains a calendar attachment (iCal). What I am attempting to do is: Send a calendar invite which is recognized by outlook and also contains an…
J_D
  • 308
  • 3
  • 16