Send mail from any from email and through other verified email from other domain

Send mail from any from email and through other verified email from other domain

I am working on a Django application that can allow users to send emails from their emails or from their domain emails after verification, I intended to use Zoho SMTP for sending emails, I wrote a function like so:

def send_email(subject, to_list, from_email, text_content, content):
    email_message = mail.EmailMultiAlternatives(
        subject=subject,
        body=text_content,
        to=tuple(to_list),
        from_email=from_email,
    )
    email_message.attach_alternative(content, "text/html")
    email_message.send()

The problem is that it always throws smtplib.SMTPDataError: (553, b'Relaying disallowed as abc@gmail.com'). Although, the first time I tried, it sent an email with an included via mydomain.com in the from section.

How can I achieve the following without having to set up my own SMTP server: website

  1. Send mail from any from_email including a via in the from section of the received email.
  2. Send mail from other domains after making them verify their domain using MX Records or something

Any links, suggestions would be highly appreciated. Thanks