“Python SMTP Sendmail” Kode Jawaban

Email otentikasi Python

import smtplib

server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.login("your username", "your password")
server.sendmail(
  "[email protected]", 
  "[email protected]", 
  "this message is from python")
server.quit()
Awful Addax

Python SMTP Sendmail

#!/usr/bin/env python

import smtplib
from email.mime.text import MIMEText

sender = '[email protected]'
receivers = ['[email protected]']


port = 1025
msg = MIMEText('This is test mail')

msg['Subject'] = 'Test mail'
msg['From'] = '[email protected]'
msg['To'] = '[email protected]'

with smtplib.SMTP('localhost', port) as server:
    
    # server.login('username', 'password')
    server.sendmail(sender, receivers, msg.as_string())
    print("Successfully sent email")
Active Programmer

Jawaban yang mirip dengan “Python SMTP Sendmail”

Pertanyaan yang mirip dengan “Python SMTP Sendmail”

Lebih banyak jawaban terkait untuk “Python SMTP Sendmail” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya