
26-11-20, 09:28
|
| Όνομα: ΣΑΚΗΣ Έκδοση λογισμικού Office: Ms-Office 2010 Γλώσσα λογισμικού Office: Ελληνική | | Εγγραφή: 24-02-2013
Μηνύματα: 326
| |
Αποστολή pdf με email gmail
Καλημέρα, τροποποίησα λίγο τον κώδικα για αποστολή email μέσω gmail αλλά χτυπάει στο σημείο που υπογραμμίζω(.Send) και βγάζει το μήνυμα που επισυνάπτω.Εννοείται έχω βάλει τα σωστά στοιχεία email στα αντίστοιχα πεδία.Δημιουργεί σωστά το pdf αρχείο στο c αλλά δεν μπορεί να το στείλει.
Private Sub email_Click()
Dim myPath As String
Dim strReportName As String
Dim idTTT As String
Dim period As String
Dim myCustomer As String
Dim myCustomer2 As String
myPath = "C:\"
myCustomer = Me.stud1.Column(2) & "_"
myCustomer2 = Me.stud1.Column(3) & "_"
idTTT = Me.idTTT.Column(1) & "_"
period = Me.etos.Column(0) & "_"
strReportName = myCustomer & myCustomer2 & idTTT & period & ".pdf"
If Me.etos <> "" And Me.stud1 <> "" Then
DoCmd.OutputTo acOutputReport, "rptPROODOS", acFormatPDF, myPath & strReportName, 0
Else
Me.Undo
End If
DoCmd.Close acReport, "rptPROODOS"
Set OutMail = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpserver") = "smtp.gmail.com"
Flds.Item(schema & "smtpserverport") = 465
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = "myemail@gmail.com"
Flds.Item(schema & "sendpassword") = "*********"
Flds.Item(schema & "smtpusessl") = 1
Flds.Update
With OutMail
.To = Me.email1
.From = "myemail@gmail.com"
.Sender = "myemail@gmail.com"
.Subject = "test" & " " & strReportName
.HTMLBody = "This is a html email, please ignore"
Set .Configuration = iConf .Send
End With
|