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
0
votes
1 answer

MailMessage Attachment on IIS Server

I am currently having an issue where I am creating a MailMessage with attachments. This works perfectly well on a local server, however once it is moved to a remote server, the application is unable to find the files that were attached. The code I…
Mark
  • 418
  • 1
  • 4
  • 13
0
votes
1 answer

Display name issue when using System.Web.Mail.MailMessage

Problem in using System.Web.Mail.MailMessage, in received message the display name is "????????". System.Web.Mail.MailMessage myMail = new System.Web.Mail.MailMessage(); myMail.BodyEncoding =…
Vasyl Senko
  • 1,779
  • 20
  • 33
0
votes
2 answers

Cannot connect to remote server while sending mail

I'm using code below to send an email and it just doesn't work and gives an exception: MailDefinition md = new MailDefinition(); md.IsBodyHtml = true; md.From = EMAIL_FROM; md.Subject = "لینک تغییر رمز"; MailMessage mm = md.CreateMailMessage(to,…
arash moeen
  • 4,533
  • 9
  • 40
  • 85
0
votes
1 answer

Send mail using RTF text as Body

I'm trying to create a mail message using some RTF text as the mail.body, but there's no IsRtfBody property on System.Net.Mail.MailMessage only IsHtmlBody. The test-mails I've received all contain {\rtf1\deff0{\fonttbl{\f0 Times New Roman;}{\f1…
Jurjen
  • 167
  • 1
  • 3
  • 10
0
votes
1 answer

How to present an email box to a client in asp.net before sending the email

I just want to be able to pre-populate a MailMessage object with all the properties of the email (from, to, subject, body, and an attachment file) and present it to the web client to decide whether to send it as is, or edit the email further before…
Fandango68
  • 4,461
  • 4
  • 39
  • 74
0
votes
1 answer

Sending hardcoded email with attachment

I am trying to write a code for sending hard coded email with attachment i-e I don't want to use the buttons and text fields. I want when the program runs it should automatically go to location in my drive and attach some files and email it to the…
0
votes
4 answers

Send e-mail in using C#

The code shown below is how I am trying to send an email. But I receive an error Failure sending mail, Can anyone tell what is problem happening here? MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new…
user3300517
  • 11
  • 1
  • 3
0
votes
3 answers

C# File Iteration Issue

string line; int counter = 0; do { line = readFile.ReadLine(); counter++; var emailAddress = line; if (line != null) { Console.WriteLine("Reading client email address..."); mailMessage.From = new…
0
votes
2 answers

in the .NET MailMessage class, how do you remove an attachment?

in the .NET MailMessage class, how do you remove an attachment? We have modified the code on a project I am working on. Part of the modifications seem to impact code that has not changed at all. It would appear that now a part of the code that…
xarzu
  • 8,657
  • 40
  • 108
  • 160
0
votes
1 answer

Cannot Access Element in Array of Emails Addresses

Here is my code for the Message.To.Add: MailMessage mailmessage = new MailMessage(); string mailFrom; mailFrom = "PropertyLossForm"; mailmessage.From = new MailAddress("propertyloss@brixmor.com", mailFrom); string mailTo; mailTo =…
sshackles
  • 143
  • 1
  • 4
  • 17
0
votes
1 answer

error analyse with multi receiver mailmessage

I have to send mail with multiple receivers. I use a mailmessage object with a "to" property containing semi-colon separated addresses. When i catch exception is there a way to know witch address generate the error? I know i can use a loop but i…
JD11
  • 306
  • 3
  • 11
0
votes
1 answer

How to add Image to Mail

In my application,I am sending mail using C#, now want to insert image in mail like does. I am passing HTML body,in mail body. So how can i insert image at run time at any position and Receiver can receive mail as mail sent. I am converting…
user1584245
0
votes
2 answers

Sending the same System.Net.MaiL.MailMessage to multiple recipients

I've got a method that basically has a "SendEmail" method (it will later be used by WCF service) It has params like, Subject, Body, etc... and a string[] of Recipients. What I do, is create a MailMessage based on the parameters, then send it using…
Alex
  • 37,502
  • 51
  • 204
  • 332
0
votes
1 answer

Mailmessage 4.0 work in framework 3.0

I have one class, work in framework 4.0, but not work in framework 3.0. I need this working in framework 3.0. I need help for work in 3.0 framework it is possible? public void EnviarEmail(string Titulo) { MensagemEmail.To.Clear(); …
0
votes
1 answer

Replace System.Net.Mail.MailMessage with manually created message and send it

I am trying to send emails that will bounce to a known mailbox. I plan to use VERP. Unfortunately the System.Net.Mail.MailMessage object does not allow me to precisely set the From: and Sender: headers within my email - it forces the values so…
DEH
  • 1,647
  • 3
  • 25
  • 45