Send email using script

vitor30221771

Member
Nov 3, 2022
18
2
3
Curitiba PR
cPanel Access Level
Website Owner
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"] = "[email protected]"
msg["To"] = "[email protected]"
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("[email protected]", "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)
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,252
2,219
363
cPanel Access Level
Root Administrator
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.