Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8266239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:05:10+00:00 2026-06-08T05:05:10+00:00

I have the following string I need to use for a confirmation email ‘from’

  • 0

I have the following string I need to use for a confirmation email ‘from’ address. This is the spanish translation which is causing a problem when viewing within a web client. Shown below.

model.FromAddresses = new EmailAddress
{
  Address = fromAddressComponents[0],
  DisplayName = fromAddressComponents[1]
};

Value taken from a resource string, shown below

  <data name="BookingConfirmation_FromAddress" xml:space="preserve">
    <value>Confirmación@test.com</value>
  </data>

Within the email client the value becomes (should be Confirmación@test.com)

=?utf-8?Q?Confirmaci=C3=B3n

Can you see how to avoid this? I know it’s because of the ó but I’m not sure how to avoid this problem!

Thanks,
James

UPDATE

Full code below:

public void Send(MailAddress to, MailAddress from, string subject, string body)
    {
        var message = new MailMessage
                          {
                              BodyEncoding = new System.Text.UTF8Encoding(true),
                              From = from,
                              Subject = subject,
                              Body = body,
                              IsBodyHtml = true
                          };


        message.To.Add(to.Address);

        var smtp = new SmtpClient() { Timeout = 100000 };
        try
        {
            smtp.Send(message);
        }
        finally
        {
            if (smtp.DeliveryMethod == SmtpDeliveryMethod.Network)
                smtp.Dispose();
        }

    }





// New Version
// --------------------------


    public override void Handle(SendEmailEmailCommand emailCommand)
    {
        if(!_config.SendEmail)
        {
            return;
        }

        var to = new MailAddress(emailCommand.To.Address, emailCommand.To.DisplayName);
        var from = new MailAddress(emailCommand.From.Address, Uri.UnescapeDataString(emailCommand.From.DisplayName));

        try
        {
            var msgBody = _compressor.Decompress(emailCommand.Body);
            _emailClient.Send(to, from, emailCommand.Subject, msgBody);
        }       
        catch (Exception ex)
        {
            _logger.Error("An error occurred when trying to send an email", ex);
            throw;
        }
    }



    public void Send(MailAddress to, MailAddress from, string subject, string body)
    {
        var message = new MailMessage
                          {
                              BodyEncoding = new System.Text.UTF8Encoding(true),
                              From = from,
                              Subject = subject,
                              Body = body,
                              IsBodyHtml = true
                          };


        message.To.Add(to.Address);

        if (!string.IsNullOrWhiteSpace(_config.BccEmailRecipents))
        {
            message.Bcc.Add(_config.BccEmailRecipents);
        }


        SendEmail(message);

        if (_config.BackupEmailsEnabled)
        {
            SendBackupEmail(message);
        }
    }



    private void SendEmail(MailMessage message)
    {
        var smtp = new SmtpClient() { Timeout = 100000 };
        try
        {
            smtp.Send(message);
        }
        finally
        {
            if (smtp.DeliveryMethod == SmtpDeliveryMethod.Network)
                smtp.Dispose();
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:05:11+00:00Added an answer on June 8, 2026 at 5:05 am

    Please look at this example below using System.Uri class methods, hope it helps you

    string email = "Confirmación@test.com";
    
    string escaped = 
           System.Uri.EscapeDataString(email); // Confirmaci%C3%B3n%40test.com
    string unescaped = 
           System.Uri.UnescapeDataString(email); //Confirmación@test.com
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a string which has the following format (3,1,Mayer,Jack). I need all 4
I have the following string: s=80 . I need to put this in an
I have following code which successfully sent email using Gmail address. But when i
I have the following string as a variable: var name1 = '001-C6AL7_deepgreen_C3AE7_tankhakinavy_FJAG7_blackredmulti_FBAE7_tanbrown.jpg'; Which is
I have this homework problem where I need to use regex to remove every
I have the following string and would like to use str_replace or preg_replace to
I have following string adId:4028cb901dd9720a011e1160afbc01a3;siteId:8a8ee4f720e6beb70120e6d8e08b0002;userId:5082a05c-015e-4266-9874-5dc6262da3e0 I need only the value of adId,siteId and userId.
I have the following string: $/Mycollection/Branches/Dev/New/php/MySite/src/MySite/somefolder/src/sad.php I need to create regex pattern and take
I have the following std::string '2010-08-10T23:59:00' and I need to convert it to a
I have a load of XSLT from a third party which i need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.