smtp

Python代码实现自动发送邮件!

半世苍凉 提交于 2019-12-12 20:14:26
在运维开发中,使用 Python 发送邮件是一个非常常见的应用场景。今天一起来探讨一下,GitHub 的大牛门是如何使用 Python 封装发送邮件代码的。 一般发邮件方法 SMTP是发送邮件的协议,Python内置对SMTP的支持,可以发送纯文本邮件、HTML邮件以及带附件的邮件。 我们以前在通过Python实现自动化邮件功能的时候是这样的: import smtplib from email.mime.text import MIMEText from email.header import Header # 发送邮箱服务器 smtpserver = 'smtp.sina.com' # 发送邮箱用户/密码 user = 'username@sina.com' password = '123456' # 发送邮箱 sender = 'username@sina.com' # 接收邮箱 receiver = 'receive@126.com' # 发送邮件主题 subject = 'Python email test' # 编写HTML类型的邮件正文 msg = MIMEText('<html><h1>你好!</h1></html>','html','utf-8') msg['Subject'] = Header(subject, 'utf-8') # 连接发送邮件 smtp =

Error Sending Email (Gmail) Via Python 2.6

妖精的绣舞 提交于 2019-12-12 20:12:22
问题 This one has been baffling me for a while. Can anyone see where i'm going wrong? This code works fine in Python 2.7; however, it breaks when running through a cron (Python 2.6). def send_email (message, status): fromaddr = 'sam@gmail.com' toaddrs = 'sam@gmail.com' server = SMTP('smtp.gmail.com', 587) server.starttls() server.login('username-example', 'password-example') server.sendmail(fromaddr, toaddrs, 'Subject: %s\r\n%s' % (status, message)) server.quit() send_email('message text','subject

Dont Send email for customers by email opencart 2.3.0.2 in admin

流过昼夜 提交于 2019-12-12 19:15:00
问题 i want to send email for customers email but show message successful but not send email for yahoo or gmail an other. my opencart is 2.3.0.2 Secure SSL/TLS Settings (Recommended) Username: sales@Max10.com Password: Use the email account’s password. Incoming Server: 23.host.com IMAP Port: 693 POP3 Port: 695 Outgoing Server: 23.host.com SMTP Port: 512 IMAP, POP3, and SMTP require authentication. Non-SSL Settings (NOT Recommended) Username: sales@Max10.com Password: Use the email account’s

how to check smtp server is working or not using php

左心房为你撑大大i 提交于 2019-12-12 18:29:33
问题 i want to check whether my websites smtp is down or up using php . I tried to connect to port 25 on my server using fsockopen, then it returns true when there is smtp service running. Which is the best method to test whether smtp or ftp running using php script. 回答1: you are talking of a smtp server , so you must have the pear framework enabled. I had a link http://www.authsmtp.com/php-pear-mail/ which can be of help. or you can do this: $f = fsockopen('smtp host', 25) ; if ($f !== false) {

Python/Django SMTP DebugServer doesn't catch emails

試著忘記壹切 提交于 2019-12-12 18:28:58
问题 I'm starting the server (on mac) this way: python -m smtpd -n -c DebuggingServer localhost:9999 and i don't get any errors or any other notifications. I guess it means all is ok, correct me if i'm wrong. But when i send emails from django shell or from my app, using send_mail/mail_managers with fail_silently=False, i dont see any output on smtpd debug server. I dont get any SMTPErrors, and send_mail/mail_managers returns 1. I ran: lsof -i | grep LISTEN to see if anyone listens to port 9999,

SmtpClient sends email to junk

℡╲_俬逩灬. 提交于 2019-12-12 17:32:12
问题 I tried to send email from c# using SmtpClient.Send() but it always goes to the junk box. It works fine if I send it from Outlook. Is there anyway to solve this? Someone told me to modify the email header but I don't know how. Thanks in advance. Here is my code SmtpClient client = new SmtpClient(); client.Host = "smtp.server.com"; client.Credentials = new System.Net.NetworkCredential("user", "password"); MailAddress mailFrom = new MailAddress("mymail@server.com"); MailAddress mailTo = new

Setting up PHPMailer using Bluehost account

℡╲_俬逩灬. 提交于 2019-12-12 17:00:21
问题 I tried contacting support from Bluehost but they don't know how to set this up. What I did is first create my email account(VPS account). Then get all the details of my email setting. Email Settings Mail Server Username: notification@website.co Standard (without SSL) Incoming Mail Server: details here Supported Ports: 143 (IMAP), 110 (POP3) Outgoing Mail Server: details here Supported Port: 26 (server requires authentication) So on my PHPMailer code I added this: $mail->SMTPAuth = true;

SMTP Error 535 (Incorrect authentication data) using PEAR mail

孤街醉人 提交于 2019-12-12 16:07:27
问题 I used the code from https://stackoverflow.com/a/2748837 to attempt to log into both Gmail and my website's server, and for both of them I received the same error: authentication failure [SMTP: Invalid response code received from server (code: 535, response: Incorrect authentication data)] I have double- and triple-checked that the usernames and passwords are correct (since it works from a desktop client), and removed the brackets around the username. What could be the problem? 来源: https:/

SMTPS: OpenSSL - SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol s23_clnt.c:787:

只愿长相守 提交于 2019-12-12 15:22:44
问题 I'm using OpenSSL in order to encrypt some emails, that a piece of hardware sends. But, whenever I try to call SSL_connect(), I get : SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol After sending "EHLO" and "STARTTLS" I call the following function: SSL_CTX *ctx = NULL; SSL *ssl = NULL; void CreateTLSSession(int sockfd) { printf("///////////////creating TLS Session/////////////////////\n"); SSL_library_init(); SSL_load_error_strings(); OpenSSL_add_all_algorithms(); ctx = SSL_CTX_new

mailer authentication error in Rails 3.2 with gmail or SendGrid

帅比萌擦擦* 提交于 2019-12-12 14:52:00
问题 I'm trying to set up mailing from a very simple Rails 3.2 app. Tried Gmail, tried SendGrid. Getting same error. Net::SMTPAuthenticationError in UsersController#create 530-5.5.1 Authentication Required Here's my section of environments/development.rb # Care if the mailer can't send config.action_mailer.raise_delivery_errors = true # Change mail delivery to either :smtp, :sendmail, :file, :test config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { address: "smtp