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
3
votes
0 answers

attachments with ics file in c#

I am trying to send an ICS (calendar) file to someone that read it using Office365, using C#. Sending just the ICS works fine. But I have to attach a file. At this point, the mail is received without calendar, or the calendar is attached to the…
3
votes
2 answers

Send email with attachment from a specific url in C#

In my view, users can search for a document and once they get the result, they can click on its id and they can download the document from specific url based on id: http://test.com/a.ashx?format=pdf&id={0} For example, if the id is 10, then url to…
thatthing
  • 676
  • 3
  • 15
  • 39
3
votes
1 answer

How i can display MailMessage in WebBrowser,RichTextBox or free component to C#

I have used S22.imap library. And I have MailMessage with embedded images, links, etc. If I use WebBrowser and displayed MailMessage body, web browser component shows only text. I read many information and many people say, just save all linkedSource…
Deimos
  • 61
  • 6
3
votes
5 answers

Convert MIME tree to MailMessage

I'm writing a a C# program that processes and forwards email messages. I have a POP3 library and a MIME parser, and I need to copy the MIME tree into a System.Net.Mail.MailMessage. What is the best way to map different MIME parts to AlternateViews,…
SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
2
votes
1 answer

.IsBodyHtml=true causes an empty email body to be sent, but .IsBodyHtml=false sends the body content

I have a WCF service that sends email based on user input. It was brought to my attention that, recently, a particular user's email were being delivered without any body text. If .IsBodyHtml is set to true, no body text is transferred; but, if…
user897052
  • 85
  • 2
  • 8
2
votes
2 answers

Supported way to send office 365 smtp email which allow us to attach a file

I have this code to send email with attachment:- $encpassword = convertto-securestring -String "*****" -AsPlainText -Force $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "***@***", $encpassword Connect-PnPOnline…
John John
  • 1
  • 72
  • 238
  • 501
2
votes
1 answer

Error Saving .NET MailMessage With Attachment To File

I am trying to build an error-handling function that will do the following: Generate an e-mail message (System.Net.Mail.MailMessage object) with an attachment Save that MailMessage to a file on disk (.eml) Open the saved file in a new mail window…
G_Hosa_Phat
  • 976
  • 2
  • 18
  • 38
2
votes
3 answers

.NET MailMessage and SMTPClient Getting Tagged as Spam?

I'm preparing basic HTML email and have used a basic HTML template with proper HEAD and BODY tags, but for some reason, my users are having trouble getting emails from me. I'm using ASP.NET MailMessage and SMTPClient objects and the mail sends just…
klkitchens
  • 1,202
  • 2
  • 16
  • 39
2
votes
2 answers

getting the path of a MailMessage attachment

I'm using a MailMessage Queue and upon exiting the program I want to save the content of the queue. I created a temp list and pass the contents of the queue to that. After that use a simple StreamWriter to write each info out. The only thing I…
ptr0x01
  • 627
  • 2
  • 10
  • 25
2
votes
0 answers

Send encrypted AND signed mail with .NET MailMessage in c#

I want to send an encrypted and signed mail without using any third-party library. I'm able to send an email signed or encrypted. But both is not working. I've tried to send a mail with Thunderbird and looked at the source, but theres nothing that…
max
  • 21
  • 1
2
votes
2 answers

Reading Mail from many different email platforms on c# windows forms application

I'm trying to read mail from different mail platforms on c#. Many people say: Microsoft.Office.Interop.Outlook.NameSpace nameSpace = application.GetNamespace("MAPI"); nameSpace.Logon("", "", Missing.Value, Missing.Value); inboxFolder =…
2
votes
1 answer

Email Attachments missing on Azure, works locally

I have implemented something similar to the following question and I can get it working locally on my server, but when I deploy to Azure it doesn't work. I don't get any errors: just an email without the attachment. Sending attachments using Azure…
Adrian
  • 670
  • 10
  • 24
2
votes
3 answers

smtp.office365.com subject encoding issues

I try to send emails with my dedicated office365 account but I have issues with subject encoding - all my special characters are replaced with "?". Code I use is pretty simple and works fine with different test account at…
kopieczek.dev
  • 706
  • 8
  • 26
2
votes
0 answers

Create an excel file and send it by email without save the file on the computer?

Is it possible to create an excel file and after send the file without to save it on the computer by email with attachment ? Now I create the excel file and I save the file in my computer and after I send the mail with the file attached. It works…
haydilen
  • 19
  • 3
2
votes
2 answers

Why encoding headers content type: text/html; is missing when use MailItem in Outlook plugin, whith the SMTP server of GMAIL: SMTP.GMAIL.COM?

I try to send HTML to gmail account, from to gmail SMTP server. If i write code like that and send HTML there is no problem. MailMessage mail = new MailMessage("aaaa@gmail.com", to, subject, body); mail.IsBodyHtml = true; …
Cédric Boivin
  • 10,854
  • 13
  • 57
  • 98