vb.net send email from shared mailbox office365

MINERVINI FABIO 1 Reputation point
2022-08-08T10:18:02.303+00:00

Hi to everybody,
i'm supposed to send an email as customer care from a shared mailbox to several addresses of my company customers.
i'm using mailkit library and i use this code

Dim contenutomail As New MimeKit.BodyBuilder  
    Dim smtpclient As New MailKit.Net.Smtp.SmtpClient  
     Dim mail As New MimeKit.MimeMessage  
     smtpclient.Connect("smtp.office365.com", 587, MailKit.Security.SecureSocketOptions.StartTls)  
     smtpclient.Authenticate("email address removed for privacy reasons", "Aprile22")  
     mail.From.Add(New MimeKit.MailboxAddress("", "email address removed for privacy reasons"))  
      For i = 0 To mailinglist.Count - 1  
     mail.Bcc.Add((New MimeKit.MailboxAddress("",mailinglist(i).ToString)))  
     Next  
     contenutomail.TextBody = ""  
     contenutomail.HtmlBody = "hello world"  
            mail.Body = contenutomail.ToMessageBody  
            smtpclient.Send(mail)  
            smtpclient.Disconnect(True)  

  

 

the problem is : sent mail are save in MY personal account SENT mailbox instead of shared SENT mailbox
can anyone help me ? i don't want to save a copy, i want the mail sent to be saved in the sent shared mailbox
I CAN T modify system registry of all computers..i'm not a system administrator.
could you help me ?
thanks
fabio``

.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,125 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,926 Reputation points
    2022-08-08T15:01:50.923+00:00

    Assuming your admin allowed smtp access to shared mailboxes, you add the mailbox name to user login name

    Username\mailboxname

    The mailbox name must be unquie. If not have admin create a unique alias.