starttls

Sending email from Python using STARTTLS

心不动则不痛 提交于 2021-02-17 21:59:47
问题 I want to send emails with a Python script by using Python's smtplib. The script should only send the email, if an encrypted connection to the server can be established. To encrypt the connection to port 587 I want to use STARTTLS. Using some examples I have written the following code: smtp_server = smtplib.SMTP(host, port=port) context = ssl.create_default_context() smtp_server.starttls(context) smtp_server.login(user, password) smtp_server.send_message(msg) msg, host, port, user, password

Sending email from Office365 with STARTTLS fails

孤人 提交于 2021-02-17 06:20:08
问题 I am trying to send an email from an Office365 server but I become the following error: panic: tls: first record does not look like a TLS handshake The account configuration is the following smtp.office365.com:587 (STARTTLS). For the authentication an username+password is needed. The code I am using is pretty similar to all the examples I saw in the web but I can't get it to work. It fails at tls.Dial. func Mail() { mail := Mail{} mail.senderId = "theemail@example.com" mail.toIds = []string{

Extending ssl/tls-message to be re-entrant in a java program

谁都会走 提交于 2021-02-11 12:26:54
问题 I'm extending the following question/solution to be re-entrant for connecting/submitting subsequent emails to an SMTP email server (e.g., Comcast), with TLS encryption. Unsupported or unrecognized ssl-message exception at startHandshake after issuing STARTTLS command in a java program I've been successful in studying and prototyping user9191556's algorithm and adapting it for subsequent emails. After much trial-n-error, I was successful in applying his/her TLS encryption capability to my

Unsupported or unrecognized ssl-message exception at startHandshake after issuing STARTTLS command in a java program

本秂侑毒 提交于 2021-02-04 21:54:30
问题 I have written a simple e-mail client in java without using the JavaMail API, as by what I read from the documentation it seems necessary to split the messages up into head and body and in the single MIME-parts for sending which would make my application a lot more complicated. Everything worked fine for a SSL port (465) but now I'm trying to use the client with a different provider that only supports STARTTLS on port 587. The following code is of a class I wrote to test the access to the

com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1;

感情迁移 提交于 2020-03-23 06:28:34
问题 package jmail; import java.util.Date; import java.util.Properties; import javax.mail.Authenticator; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class HtmlJavaSend { public void sendHtmlEmail(String host, String port, final String userName,

JavaMail smtp properties (for STARTTLS)

戏子无情 提交于 2019-12-28 09:55:06
问题 JavaMail specifies a bunch of properties that can be set to configure an SMTP connection. To use STARTTLS it is necessary to set the following property mail.smtp.starttls.enable=true Where do I specify the username/password to use the smtp service? Is it enough to specify the: mail.smtp.user=me mail.smtp.password=secret Or do I have to explicitely login using the: transport.connect(server, userName, password) Yes, I already tried to do this and it seems that it is necessary to connect using

Wrapping an existing socket in SSL - Python

て烟熏妆下的殇ゞ 提交于 2019-12-24 03:19:44
问题 I'm having some trouble wrapping an existing socket connection in ssl in a Python program. Essentially, it's an implementation of STARTTLS, i.e. a currently connected client can issue the STARTTLS command and the server will secure the connection. Here's the portion of the code that I'm struggling with: self.client_s = ssl.wrap_socket( self.client_s, certfile='/path/to/cert.crt', keyfile='/path/to/key.key', do_handshake_on_connect=False ) while True: try: self.client_s.do_handshake() break

Java Netty Unknown SSL content type error

♀尐吖头ヾ 提交于 2019-12-23 01:47:39
问题 I'm trying to write a HTTP client using Netty 5.0.0.Alpha2 to connect to a proprietary server. I can only describe the connection as being similar to Websockets but not. The server utilizes StartTLS which is expected to be initialized by the client after the server responds with 200 and Content Type and if you don't, the server disconnects you. Once the connection is secure, the server will keep the connection alive indefinitely while responding to client commands. Anyways, below is my

tls: oversized record received with length XXXXX

浪子不回头ぞ 提交于 2019-12-21 20:26:03
问题 I use the built-in standard SSL socket client library (net + crypto/tls) like this: conn, err := net.Dial("tcp", "exploit.im:5222") //... config := tls.Config{InsecureSkipVerify: true} tls_conn := tls.Client(conn, &config) fmt.Println(tls_conn.Handshake()) And am getting the message: conn, err := net.Dial("tcp", "exploit.im:5222") I managed to find out it is somehow related to the default maximum packet size (16384 + 2048 set in common.go:31). Is there any standard work around (without

Using tls-extra for simple smtp

时间秒杀一切 提交于 2019-12-21 04:18:08
问题 I am trying to write a simple script to send a mail via my gmail account. But I am a beginner so it is not that simple. I tryed google but exept for hackage, there is no help or examples at all. The problem is that I did not find the way to use tls-extra(or tls) to initiate the STARTTLS exchange. Ok, here is the code: import Network import Network.TLS.Extra import System.IO import Text.Printf server = "smtp.gmail.com" port = 25 --that has to chage, I think forever a = a >> forever a main =