Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't send email #79

Open
iBuitron opened this issue May 4, 2023 · 4 comments
Open

Can't send email #79

iBuitron opened this issue May 4, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@iBuitron
Copy link

iBuitron commented May 4, 2023

just a simple dash app.


def send_email(to_email):
    
    outlook.username = '[email protected]'
    outlook.password = 'xxxxx'

    # And then you can send emails
    outlook.send(
        subject="Example email",
        receivers=[to_email],
        text="Hi, this is an email."
    )

getting this error:

smtplib.SMTPHeloError: (501, b'5.5.4 Invalid domain name [SCZP152CA0017.LAMP152.PROD.OUTLOOK.COM 2023-05-04T21:24:07.002Z 08DB4C5CCB756BD2]')

@iBuitron iBuitron added the bug Something isn't working label May 4, 2023
@justinepaulpadayao
Copy link

justinepaulpadayao commented May 5, 2023

I'm receiving the same error.

smtplib.SMTPSenderRefused: (530, b'5.7.57 Client not authenticated to send mail. [DB6PR07CA0177.eurprd07.prod.outlook.com 2023-05-05T09:18:15.054Z 08DB4D358B9A6494]', '[email protected]')

@iBuitron
Copy link
Author

iBuitron commented May 5, 2023

@justinepaulpadayao

This is my snippe code for gmail, hope helps you:
(is made for a web, sending mails from my second account to my main account with the data summinted by the costumer)

import smtplib
from email.mime.text import MIMEText

def send_email(full_name, customer_email, mobile, subject, customer_message):
    # Configurar la conexión SMTP
    smtp_server = 'smtp.gmail.com'
    smtp_port = 465
    
    smtp_user = '[email protected]'
    smtp_password = 'xxxxxxxxxxxxxx'  (this is a app password, not a gmail password, you have to request it on gmail)
    
    from_email = '[email protected]'
    to_email = '[email protected]'

    with smtplib.SMTP_SSL(smtp_server, smtp_port) as server:
        server.login(smtp_user, smtp_password)

        # how i see the data on my main email
        message = f'''

        fullname: {full_name}
        email: {customer_email}
        mobile: {mobile}
        subject: {subject}
        
        --
        {customer_message} 
        --
        
        '''

        msg = MIMEText(message)
        msg['From'] = from_email
        msg['To'] = to_email
        msg['Subject'] = subject

        # send email
        server.send_message(msg, from_email, to_email)

@Miksus
Copy link
Owner

Miksus commented May 6, 2023

At least yesterday my emails went through. I'll try if I can reproduce this.

@Miksus
Copy link
Owner

Miksus commented May 6, 2023

Are you still facing the same issue? Or does it persist?

I tested Outlook (and also Gmail) and they both work fine. I wonder if this was a temporary issue in Outlook's servers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants