Results 1 to 2 of 2

Thread: email

  1. #1
    Join Date
    May 2021
    Posts
    1
    Qt products
    Qt5 PyQt3 PyQt4
    Platforms
    Windows

    Default email

    Hello,
    I have a software made in access that sends emails automatically. How do I do this in Qt?
    Below my code.
    Thank you very much

    Qt Code:
    1. Private Sub VisualizarEmPDF_Click()
    2. Dim assinatura As Variant
    3. Dim blRet As Boolean
    4.  
    5. Dim SqlF As String
    6. Dim cr As Recordset
    7. Dim reduz, Email,
    8.  
    9. SqlF = "SELECT SA1.A1_COD, SA1. A1_NREDUZ “
    10. SqlF = SqlF & " SA1.A1_EMLCOM
    11. SqlF = SqlF & " FROM SA1"
    12. SqlF = SqlF & " WHERE (SA1.A1_COD)=" & "'" & [Forms]![CotacoesCC_TI].[Cliente] & "'"
    13.  
    14. Set cr = CurrentDb.OpenRecordset(SqlF)
    15. reduz = cr("A1_NREDUZ")
    16.  
    17. blRet = ConvertReportToPDF("CotacoesRelatorio", vbNullString, "C:\Cotacoes" & "Kap_Orçamento_Nº_" & NDaCotacao & "_" & Trim(A1_NREDUZ) & "_Data_" & Format(Data, "dd_mm_yy") & ".PDF", False, True)
    18.  
    19. Dim objOut As Object
    20. Dim objMail As Object
    21. Dim HTM As String
    22. Dim HTMLBody
    23.  
    24. objMail.attachments.Add "C:\Cotacoes\Kap_Orçamento_Nº_" & Trim(Me.NDaCotacao) & "_" & Trim(Me.A1_NREDUZ) & "_Data_" & Format(Data(), "dd_mm_yy") & ".PDF"
    25.  
    26. HTM = ""
    27. Set objOut = CreateObject("Outlook.application")
    28.  
    29. Dim oOutLook As Object
    30. On Error Resume Next
    31. Set oOutLook = GetObject(, "Outlook.Application") 'Bind to existing instance
    32.  
    33. Set objMail = objOut.CreateItem(0)
    34. objMail.TO = Me.Email
    35. objMail.Subject = "KAP Componentes Elétricos LTDA - Orçamento: " & "Nº_" & Trim(Me.NDaCotacao)
    36.  
    37. HTM = HTM & "<font size='3' face='Tahoma'>" & Hora & " " & ContatoCli & ", como vai?" & "<br>"
    38. HTM = HTM & "Em anexo o seu orçamento." & "<br><br>"
    39.  
    40. assinatura = pega_assinatura("C:\Documents and Settings" & _
    41. Environ("username") & "\AppData\Roaming\Microsoft\Assinaturas" & UsuarioRede & ".htm")
    42. HTM = HTM & assinatura
    43. HTM = HTM & "</font>"
    44.  
    45. objMail.HTMLBody = HTM
    46. objMail.Display
    47. objMail.attachments.Add "C:\Cotacoes\Kap_Orçamento_Nº_" & Trim(Me.NDaCotacao) & "_" & Trim(Me.A1_NREDUZ) & "_DATA_" & Format(Data)
    48. Set objMail = Nothing
    49. Set objOut = Nothing
    50. End Sub
    To copy to clipboard, switch view to plain text mode 
    Last edited by d_stranz; 25th August 2022 at 17:59. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,246
    Thanks
    304
    Thanked 866 Times in 853 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: email

    Look at the cutelyst library, which implements basic SMTP services in the Qt framework.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Sending email using Qt.
    By johnny_sparx in forum Qt Programming
    Replies: 34
    Last Post: 24th August 2013, 18:56
  2. Email from my qt app
    By druvraj in forum Qt Programming
    Replies: 2
    Last Post: 12th July 2012, 00:27
  3. qt email
    By zyl8554 in forum Qt Programming
    Replies: 7
    Last Post: 23rd May 2011, 10:35
  4. How to send email and attachement via default email client
    By richardander in forum Qt Programming
    Replies: 3
    Last Post: 1st December 2009, 05:40
  5. Replies: 7
    Last Post: 5th January 2009, 09:27

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.