Open Closed

Changing System.Net.Mail.MailMessage.From information #301

naeazach created

So, for some reason when the app sends mails for me there is no display name ( i dont recall if i set one or not).

Also, the box i'm sending from is an exchange email so it supports aliasing, i'd like to swap out the display name and display address when sending mail for certain system messaging. however when i try this:

        emailMsg.From.DisplayName = "Site Support Center";
        emailMsg.From.Address = "";

Both of those are ready only properties. So, my mail box name is "help" so the display name on the emails that comes in just "help" instead of "My Site Help Center" or whatever.

So ... a.) Is it possible to set the default display name for the smtp account for the site. b.) how in one off instances do i manually set it?

Thanks! Also have you figured out an upgrade price? I have another project coming my way I'd like to use the starter kit again for. Zach

3 Answer(s)
  • 0
    naeazach created

    Upon further inspection I do see that the tenant settings table has these values:

    Abp.Net.Mail.DefaultFromAddress Abp.Net.Mail.DefaultFromDisplayName

    However, defaultfromdisplayname seems to be ignored.

    So is there away I can manually set both those settings?

  • 0
    hikalkan created
    Support Team


    You can always set Display name. Example, inject IEmailSender (as _emailSender) and use it as shown below:

    var mail = new MailMessage();
                mail.From = new MailAddress("", "My display name");
                //set other properties...
                await _emailSender.SendAsync(mail);

    Yes, mail.From.DisplayName is readonly, but you can set mail.From. Also, MailMessage is .NET framework's class, not AspNet Zero's.

    If you have Regular License and want to create 2nd project, then you can pay the difference and get the Enterprise License (which allows up to 5 projects). When you need it, please contact to <a href=""></a>

    I will check for Abp.Net.Mail.DefaultFromDisplayName if it's ignored. You can follow the issue on Github: <a class="postlink" href=""></a>


  • 0
    naeazach created

    thank you as always for the fantastic support.