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

  • Home
  • SEARCH
  • 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 9148533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:18:06+00:00 2026-06-17T11:18:06+00:00

I am using MailMessage to send email from a web application. I believe I

  • 0

I am using MailMessage to send email from a web application. I believe I have the correct code in to “mask” the from name in the SendEmail() function

public static void SendEmail(string toAddress, string ccAddress, string bccAddress, string subject, string body, MemoryStream attachment, string attachmentName, bool isHtml, string fromAlias = "info@cipollainsurance.com")
    {
        using (MailMessage message = new MailMessage())
        {
            AlternateView htmlView = AlternateView.CreateAlternateViewFromString(AddHeaderAndFooter(subject, body).ToString(), new System.Net.Mime.ContentType("text/html"));

            var resources = LoadResources();

            foreach (LinkedResource resource in resources)
            {
                htmlView.LinkedResources.Add(resource);
            }

            message.AlternateViews.Add(htmlView);

            if (!string.IsNullOrEmpty(toAddress))
            {
                var addresses = toAddress.Split(',', ';');

                foreach (string address in addresses)
                {
                    message.To.Add(address);
                }
            }

            if (!string.IsNullOrEmpty(ccAddress))
            {
                var ccAddresses = ccAddress.Split(',', ';');

                foreach (string cc in ccAddresses)
                {
                    message.CC.Add(cc);
                }
            }

            if (!string.IsNullOrEmpty(bccAddress))
            {
                var bccAddresses = bccAddress.Split(',', ';');

                foreach (string bcc in bccAddresses)
                {
                    message.Bcc.Add(bcc);
                }
            }

            if (!string.IsNullOrWhiteSpace(fromAlias))
            {
                message.Sender = new MailAddress("info@cipollainsurance.com", fromAlias, System.Text.Encoding.ASCII);
            }
            message.Body = body;
            message.BodyEncoding = System.Text.Encoding.UTF8;
            message.Subject = subject;
            message.SubjectEncoding = System.Text.Encoding.UTF8;
            message.IsBodyHtml = isHtml;
            message.From = new MailAddress("info@cipollainsurance.com", "Cipolla Insurance");

            if (attachment != null)
            {
                message.Attachments.Add(new Attachment(attachment, attachmentName));
            }

            SmtpClient client = new SmtpClient();
            client.Send(message);
        }
    }

However the from email address still says email and email@webedgemedia.com which is what is specified in web.config.

<smtp from="info@cipollainsurance.com" deliveryMethod="Network">
    <network host="smtp.gmail.com" enableSsl="true" port="587" password="myPassword" userName="email@webedgemedia.com" />
</smtp>

Can someone identify what I’m missing to send the email out as info@cipollainsurance.com?

  • 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-17T11:18:07+00:00Added an answer on June 17, 2026 at 11:18 am

    I don’t believe GMAIL allows you to do that – it makes it pretty trivial to use their services as a SPAM relay otherwise.

    The most you can do is set a different REPLY-TO but your GMAIL (account) email is still FROM.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the following code to send an email from my vb.net web application.
I'm using the excellent MvcMailer package to send email from within my application. I'm
We are using this coding to send email from an ASP.Net code-behind Vb.Net file.
I am trying to send an email via GMail from ASP.Net using the code
I am trying to use the below code to send email from asp.net(C#). using
I have a MailMessage class I've written to manage sending email from my application.
I´m trying to send an email through gmail using this code: MailMessage msg =
I am using a Send-MailMessage function to email the log files of a backup.
I am using SmtpClient and MailMessage to send emails from ASP.Net code. I want
In my MVC4 application, I'm using the SmtpClient to send out email via Gmail's

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.