How to send email out with self-made email client via Zimbra's smtp?

Post feedback about our hosted demo or your local install. Tell us what you love and/or what you’d like to see added in the future.
Posts: 2
Joined: Fri Oct 22, 2021 7:14 am

How to send email out with self-made email client via Zimbra's smtp?

Postby jackshooter » Mon Nov 15, 2021 5:54 pm

I hoped that I did not post my question on the wrong section of Zimbra forums.

I currently have an email client app, built with Flutter web. I hoped that my email client app can send out to any email providers outside (Gmail, Outlook, etc.) and receives emails that was stored in my zimbra's Inbox: e.g., someone' are Zimbra mailboxes).

So, my email client uses ASP. NET Core 5.0 web API on sending emails which is as follows (currently using Gmail's SMTP & POP3:

Code: Select all

public async Task Send(EmailMessage email)
            var message = new MimeMessage();
            message.To.AddRange(email.toAddresses.Select(x => new MailboxAddress(x.Name, x.Address)));
            message.From.AddRange(email.fromAddresses.Select(x => new MailboxAddress(x.Name, x.Address)));

            message.Subject = email.Subject;
            var builder = new BodyBuilder();
            builder.HtmlBody = email.Body;
            using (var smtp = new SmtpClient())
                smtp.Connect("", 587, false);
                smtp.Authenticate("<[i]gmail username[/i]>", "<[i]gmail password[/i]>");
                await smtp.SendAsync(message);


ReceiveEmail() (Get from Gmail's inbox and display on my Flutter web's email client app)

Code: Select all

public async Task<List<EmailMessage>> ReceiveEmail(int maxCount = 5)
            using(var emailClient = new Pop3Client())
                emailClient.Connect("", 995, true);
                emailClient.Authenticate("<[i]gmail username[/i]>", "<[i]gmail password[/i]>");
                List<EmailMessage> emails = new List<EmailMessage>();
                for(int i=0;i<emailClient.Count && i<maxCount; i++)
                    var message =await emailClient.GetMessageAsync(i);
                    var emailMessage = new EmailMessage
                        Body = !string.IsNullOrEmpty(message.HtmlBody) ? message.HtmlBody : message.TextBody,
                        Subject = message.Subject
                    emailMessage.toAddresses.AddRange(message.To.Select(x => (MailboxAddress)x).Select(x => new EmailAddress { Address = x.Address, Name = x.Name }));
                    emailMessage.fromAddresses.AddRange(message.From.Select(x => (MailboxAddress)x).Select(x => new EmailAddress { Address = x.Address, Name = x.Name }));
                return emails;

Now the case was to use Zimbra, instead of Gmail.

So how should I perform the operation, or how should I do it, when it goes for Zimbra?

Return to “Users”

Who is online

Users browsing this forum: No registered users and 3 guests