Send email using script
I am trying to send emails, using my custom domain. Searching, I find a python code and it's work with gmail/hotmail. I already have problems when I try to register an email using the domain in an email marketing platform
This is the python code:
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import smtplib
msg = MIMEMultipart()
msg["From"> = "contact@mydomain"
msg["To"> = "email.user@gmail.com"
body_text = "testt :)"
body_part = MIMEText(body_text, 'plain')
msg.attach(body_part)
with smtplib.SMTP(host="smtp.mydomain", port=587) as smtp_obj:
smtp_obj.starttls()
smtp_obj.ehlo()
smtp_obj.login("contact@mydomain", "mypassword")
smtp_obj.sendmail(msg['From'>, [msg['To'>,], msg.as_string())
Appreaciate any help. I think it's needed to config something in cpanel. Maybe the DNS? I really dont want to alter the DNS records, because it has a lot of things working and it's to screw up the whole system (at least for me xD)
-
Hey there! This doesn't seem like a cPanel issue, but can you let me know the error you're getting when you try and run that script? That could point us in the right direction. 0 -
Hey! Thanks for reply I'm facing this error: [Errno 11001] getaddrinfo failed 0 -
Thanks for that information - that error message wouldn't be related to cPanel, but would be an issue with the script itself. You might want to reach out to a developer for help with that script to get that configured, as we don't provide that type of support on our end. If the script has any server-side requirements, I can help you to ensure those are met as much as possible on the cPanel side of things. 0
Please sign in to leave a comment.
Comments
3 comments