1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] MailerSend failing to send email

Discussão em 'Python' iniciado por Stack, Setembro 14, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to send email using MailerSend, I used a readme file in their github repository.

    I have installed it using pip install mailersend

    Imported functions i want to use in mailersend from mailersend import MailerSendClient, EmailBuiler

    I have set up the API in the environment and used 'dotenv' to load the api to my working file.

    `from dotenv import load_env

    load_dotenv()`

    And after this part I initialized the mailer send client and prepared the to send, used send().

    ms = MailerSendClient()


    email = (EmailBuilder().from_email('emaildomain@domain.com', 'Cybershield Linknguard').to_many([{'email': 'sivuyisencapayi@gmail.com', 'name': 'Sivuyise'}])).subject('Test Email').text('This is a test email from MailerSend').build()

    response = ms.send(email)

    if response.status_code == 202: print("Email sent successfully!") else: print("Failed to send email.")

    When i use python send_email.py it give out an error message in the log

    python send_email.py Traceback (most recent call last): File "C:\Users\Lenovo\Desktop\Msebetsi Solutions\cyber-shield-linkguard\cyber-shield-linkguard\send_email.py", line 10, in <module> response = ms.send(email) ^^^^^^^ AttributeError: 'MailerSendClient' object has no attribute 'send'

    I double check if mailersend is installed

    pip show mailersend

    and it show it's installed and is version: 2.0.0

    and reviewed the code again and changed the from_email() parameter to a domain provided by mailersend, still show problem associated with send()

    Continue reading...

Compartilhe esta Página