I didn't know if switching email methods might solve the issue, so I figured on tackling it then if it still happens. Do you use Outlook?
I didn't know if switching email methods might solve the issue, so I figured on tackling it then if it still happens. Do you use Outlook?
In answer to your PM (technical discussion should take place on the thread):
Yes, i did, but i don't know where to put that code. I don't know how to switch method. Any advice? Many thanks!
the automation code in the link is a public function. You'd paste the whole bit into a standard module. Then you'd replace the SendObject line in your code with a call to his function:
SendEmail rsEmails!email, "Subject", strBody,...
and within the function change the line assigning the body to:
.HTMLBody = strBody
I implemented the function and call it. It's amazing!
Switching to this email method:
- solved the error
- html is in place
- i don't have to give permission for every email
Yes, i use Outlook.
Many, many thanks. You're a genius!
Happy to help! You'll get a lot of arguments on the "genius" comment, and rightly so.
Well, i'll take them as off topic.
LOL! I'm not a genius, just a good thief of other people's work.
Reality check! Unfortunately i have another issue with the code. each email that it generates it appends the new strBody content in the email without clearing the previews value. so the last email contains all the activities for everybody instead of just one person activity. Looks like i need a command to clear strBody value when move next. Any ideas?
Code:Public Function SendTestEMail() Dim rsData As DAO.Recordset Dim rsEmails As DAO.Recordset Dim strBody As String Set rsEmails = CurrentDb.OpenRecordset("SELECT Email FROM oameni;") While Not rsEmails.EOF Set rsData = CurrentDb.OpenRecordset("SELECT * FROM [oameni si activitati q] WHERE Email='" & rsEmails!Email & "';") While Not rsData.EOF 'code to build email body using rsData record strBody = strBody & "<b>ACTIVITATE</b>" & "<br>" & rsData!Activitate & "<br>" & "<b>DESCRIERE ACTIVITATE</b>" & "<br>" & rsData![Descriere activitate] & "<p>" & rsData!link & "<p>" 'Attachments.Add ("C:\Users\Theodor\Desktop\focus online.docx") rsData.MoveNext Wend 'code to send email SendEmail rsEmails!Email, "activitati Baneasa Forest Run", strBody, True ', , rsData!Path rsData.Close rsEmails.MoveNext Wend End Function
Ah, missed that, sorry. Before the inner loop, reset the variable:
...
strBody = ""
While Not rsData.EOF
...
Yep, this is it! Thanks!
ps. no more praising.