Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Issue with "QSslSocket" when Sending an Email
Forum Updated to NodeBB v4.3 + New Features

Issue with "QSslSocket" when Sending an Email

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 164 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mourad2024
    wrote on last edited by
    #1

    Hello everyone,
    To start, here are the tools I'm using:

    QtCreator as the IDE
    C++/Qt as the programming language
    I'm trying to create an application that allows me to send an email with an attachment.

    Here’s what I’ve done so far:

    My main.cpp file is configured for the basic setup and email sending.
    I’ve implemented an SmtpClient class in smtpclient.h and smtpclient.cpp to handle the email-sending process, including authentication and attaching files.
    However, when I run the program, I get the following messages in the console:

    swift
    Copier
    Modifier
    Connecting to SMTP server: "smtp.gmail.com" on port: 465
    Connected to SMTP server.
    Server response: "220 smtp.gmail.com ESMTP ffacd0b85a97d-38bf322b337sm16834709f8f.59 - gsmtp\r\n"
    Sending command: "EHLO Projet_test_02_Exemple_Qt"
    Socket state: QAbstractSocket::ConnectedState
    Raw response data: ""
    Server response: "250-smtp.gmail.com at your service, [77.131.3.249]\r\n250-SIZE 35882577\r\n250-8BITMIME\r\n250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH\r\n250-ENHANCEDSTATUSCODES\r\n250-PIPELINING\r\n250 SMTPUTF8\r\n"
    EHLO successful. Proceeding with authentication.
    Sending command: "AUTH LOGIN"
    Socket state: QAbstractSocket::ConnectedState
    Raw response data: ""
    Server response: "334 VXNlcm5hbWU6\r\n"
    Sending command: "bS5tb3VyYWQwMTExQGdtYWlsLmNvbQ=="
    Socket state: QAbstractSocket::ConnectedState
    Raw response data: ""
    Server response: "334 UGFzc3dvcmQ6\r\n"
    Sending command: "eXpveiBxcmJ0IGxla2Egamh1dw=="
    Socket state: QAbstractSocket::ConnectedState
    Raw response data: ""
    Server response: "235 2.7.0 Accepted\r\n"
    Authentication successful. Proceeding to send email.
    Sending command: "MAIL FROM:m.mourad0111@gmail.com"
    Socket state: QAbstractSocket::ConnectedState
    Raw response data: ""
    Server response: "250 2.1.0 OK ffacd0b85a97d-38bf322b337sm16834709f8f.59 - gsmtp\r\n"
    Despite this, I’m unable to successfully send the email, and no further progress is made after the MAIL FROM command.

    Could someone help identify what might be going wrong or how I can resolve this issue?

    Thank you in advance for your help!

    JonBJ Pl45m4P C 3 Replies Last reply
    0
    • M Mourad2024

      Hello everyone,
      To start, here are the tools I'm using:

      QtCreator as the IDE
      C++/Qt as the programming language
      I'm trying to create an application that allows me to send an email with an attachment.

      Here’s what I’ve done so far:

      My main.cpp file is configured for the basic setup and email sending.
      I’ve implemented an SmtpClient class in smtpclient.h and smtpclient.cpp to handle the email-sending process, including authentication and attaching files.
      However, when I run the program, I get the following messages in the console:

      swift
      Copier
      Modifier
      Connecting to SMTP server: "smtp.gmail.com" on port: 465
      Connected to SMTP server.
      Server response: "220 smtp.gmail.com ESMTP ffacd0b85a97d-38bf322b337sm16834709f8f.59 - gsmtp\r\n"
      Sending command: "EHLO Projet_test_02_Exemple_Qt"
      Socket state: QAbstractSocket::ConnectedState
      Raw response data: ""
      Server response: "250-smtp.gmail.com at your service, [77.131.3.249]\r\n250-SIZE 35882577\r\n250-8BITMIME\r\n250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH\r\n250-ENHANCEDSTATUSCODES\r\n250-PIPELINING\r\n250 SMTPUTF8\r\n"
      EHLO successful. Proceeding with authentication.
      Sending command: "AUTH LOGIN"
      Socket state: QAbstractSocket::ConnectedState
      Raw response data: ""
      Server response: "334 VXNlcm5hbWU6\r\n"
      Sending command: "bS5tb3VyYWQwMTExQGdtYWlsLmNvbQ=="
      Socket state: QAbstractSocket::ConnectedState
      Raw response data: ""
      Server response: "334 UGFzc3dvcmQ6\r\n"
      Sending command: "eXpveiBxcmJ0IGxla2Egamh1dw=="
      Socket state: QAbstractSocket::ConnectedState
      Raw response data: ""
      Server response: "235 2.7.0 Accepted\r\n"
      Authentication successful. Proceeding to send email.
      Sending command: "MAIL FROM:m.mourad0111@gmail.com"
      Socket state: QAbstractSocket::ConnectedState
      Raw response data: ""
      Server response: "250 2.1.0 OK ffacd0b85a97d-38bf322b337sm16834709f8f.59 - gsmtp\r\n"
      Despite this, I’m unable to successfully send the email, and no further progress is made after the MAIL FROM command.

      Could someone help identify what might be going wrong or how I can resolve this issue?

      Thank you in advance for your help!

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Mourad2024 said in Issue with "QSslSocket" when Sending an Email:

      Server response: "250 2.1.0 OK ffacd0b85a97d-38bf322b337sm16834709f8f.59 - gsmtp\r\n"

      So far as I know 250 2.1.0 OK indicates that "the email was delivered to the recipient server and the recipient's email address was accepted". So are you claiming it is not sent?

      1 Reply Last reply
      2
      • M Mourad2024

        Hello everyone,
        To start, here are the tools I'm using:

        QtCreator as the IDE
        C++/Qt as the programming language
        I'm trying to create an application that allows me to send an email with an attachment.

        Here’s what I’ve done so far:

        My main.cpp file is configured for the basic setup and email sending.
        I’ve implemented an SmtpClient class in smtpclient.h and smtpclient.cpp to handle the email-sending process, including authentication and attaching files.
        However, when I run the program, I get the following messages in the console:

        swift
        Copier
        Modifier
        Connecting to SMTP server: "smtp.gmail.com" on port: 465
        Connected to SMTP server.
        Server response: "220 smtp.gmail.com ESMTP ffacd0b85a97d-38bf322b337sm16834709f8f.59 - gsmtp\r\n"
        Sending command: "EHLO Projet_test_02_Exemple_Qt"
        Socket state: QAbstractSocket::ConnectedState
        Raw response data: ""
        Server response: "250-smtp.gmail.com at your service, [77.131.3.249]\r\n250-SIZE 35882577\r\n250-8BITMIME\r\n250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH\r\n250-ENHANCEDSTATUSCODES\r\n250-PIPELINING\r\n250 SMTPUTF8\r\n"
        EHLO successful. Proceeding with authentication.
        Sending command: "AUTH LOGIN"
        Socket state: QAbstractSocket::ConnectedState
        Raw response data: ""
        Server response: "334 VXNlcm5hbWU6\r\n"
        Sending command: "bS5tb3VyYWQwMTExQGdtYWlsLmNvbQ=="
        Socket state: QAbstractSocket::ConnectedState
        Raw response data: ""
        Server response: "334 UGFzc3dvcmQ6\r\n"
        Sending command: "eXpveiBxcmJ0IGxla2Egamh1dw=="
        Socket state: QAbstractSocket::ConnectedState
        Raw response data: ""
        Server response: "235 2.7.0 Accepted\r\n"
        Authentication successful. Proceeding to send email.
        Sending command: "MAIL FROM:m.mourad0111@gmail.com"
        Socket state: QAbstractSocket::ConnectedState
        Raw response data: ""
        Server response: "250 2.1.0 OK ffacd0b85a97d-38bf322b337sm16834709f8f.59 - gsmtp\r\n"
        Despite this, I’m unable to successfully send the email, and no further progress is made after the MAIL FROM command.

        Could someone help identify what might be going wrong or how I can resolve this issue?

        Thank you in advance for your help!

        Pl45m4P Offline
        Pl45m4P Offline
        Pl45m4
        wrote on last edited by
        #3

        @Mourad2024 said in Issue with "QSslSocket" when Sending an Email:

        Sending command: "MAIL FROM

        In addition to @JonB :
        Not clever to leak your Gmail address...it makes the bots happy :)


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        1 Reply Last reply
        0
        • M Mourad2024

          Hello everyone,
          To start, here are the tools I'm using:

          QtCreator as the IDE
          C++/Qt as the programming language
          I'm trying to create an application that allows me to send an email with an attachment.

          Here’s what I’ve done so far:

          My main.cpp file is configured for the basic setup and email sending.
          I’ve implemented an SmtpClient class in smtpclient.h and smtpclient.cpp to handle the email-sending process, including authentication and attaching files.
          However, when I run the program, I get the following messages in the console:

          swift
          Copier
          Modifier
          Connecting to SMTP server: "smtp.gmail.com" on port: 465
          Connected to SMTP server.
          Server response: "220 smtp.gmail.com ESMTP ffacd0b85a97d-38bf322b337sm16834709f8f.59 - gsmtp\r\n"
          Sending command: "EHLO Projet_test_02_Exemple_Qt"
          Socket state: QAbstractSocket::ConnectedState
          Raw response data: ""
          Server response: "250-smtp.gmail.com at your service, [77.131.3.249]\r\n250-SIZE 35882577\r\n250-8BITMIME\r\n250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH\r\n250-ENHANCEDSTATUSCODES\r\n250-PIPELINING\r\n250 SMTPUTF8\r\n"
          EHLO successful. Proceeding with authentication.
          Sending command: "AUTH LOGIN"
          Socket state: QAbstractSocket::ConnectedState
          Raw response data: ""
          Server response: "334 VXNlcm5hbWU6\r\n"
          Sending command: "bS5tb3VyYWQwMTExQGdtYWlsLmNvbQ=="
          Socket state: QAbstractSocket::ConnectedState
          Raw response data: ""
          Server response: "334 UGFzc3dvcmQ6\r\n"
          Sending command: "eXpveiBxcmJ0IGxla2Egamh1dw=="
          Socket state: QAbstractSocket::ConnectedState
          Raw response data: ""
          Server response: "235 2.7.0 Accepted\r\n"
          Authentication successful. Proceeding to send email.
          Sending command: "MAIL FROM:m.mourad0111@gmail.com"
          Socket state: QAbstractSocket::ConnectedState
          Raw response data: ""
          Server response: "250 2.1.0 OK ffacd0b85a97d-38bf322b337sm16834709f8f.59 - gsmtp\r\n"
          Despite this, I’m unable to successfully send the email, and no further progress is made after the MAIL FROM command.

          Could someone help identify what might be going wrong or how I can resolve this issue?

          Thank you in advance for your help!

          C Offline
          C Offline
          ChrisW67
          wrote on last edited by ChrisW67
          #4

          @Mourad2024 said in Issue with "QSslSocket" when Sending an Email:

          Despite this, I’m unable to successfully send the email, and no further progress is made after the MAIL FROM command.

          What further progress have you tried? 250 Ok indicates the envelope sender was accepted but you appear to have not sent anything more.

          You should be sending one or more RCPT TO:<alice@example.com> lines, a DATA line, the email headers, blank line, message body, and a line containing only a period to complete the transfer. See SMTP transport example.

          BTW; What does any of this have to do with the thread title?

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved