Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 10-19-2018, 10:05 AM   #1
BennyLinton
Newly Registered User
 
Join Date: Feb 2014
Posts: 199
Thanks: 24
Thanked 1 Time in 1 Post
BennyLinton is on a distinguished road
SendGrid API for SMTP emails

Does anyone have any familiarity using SendGrid API for SMTP emails? I'm trying to reference its key values in my VBA for automated sending of emails.

BennyLinton is offline   Reply With Quote
Old 10-25-2018, 05:20 AM   #2
Uncle Gizmo
Nifty Access Guy
 
Uncle Gizmo's Avatar
 
Join Date: Jul 2003
Location: Newbury Berks UK
Posts: 9,518
Thanks: 363
Thanked 782 Times in 747 Posts
Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough
Send a message via Skype™ to Uncle Gizmo
Re: SendGrid API for SMTP emails

I note that your post has yet to receive a reply. It may well have been missed by the members so I thought I would bump it up the list to give you a second go at getting an answer!
__________________
Code:
                 |||||
               @(~^~)@
-------------oOo---U---oOo-------------
|                                     |
|      Uncle Gizmo              |
|                                     |
|                                     |
| Get $20 worth of "Nifty Code"       |
|      
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
| | Ooo | |_________________ooO____( )________| ( ) ) / \ ( (_/ \_)
Uncle Gizmo is offline   Reply With Quote
Old 10-30-2018, 01:46 AM   #3
sonic8
Newly Registered User
 
Join Date: Oct 2015
Posts: 122
Thanks: 23
Thanked 37 Times in 36 Posts
sonic8 is on a distinguished road
Re: SendGrid API for SMTP emails

There is a sample for using the SendGrid-API with VBA available right here on AWS.

__________________
New Video:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
, recorded at the AEK conference, Nuremberg, Oct. 2018.
sonic8 is offline   Reply With Quote
Old 11-01-2018, 12:17 PM   #4
BennyLinton
Newly Registered User
 
Join Date: Feb 2014
Posts: 199
Thanks: 24
Thanked 1 Time in 1 Post
BennyLinton is on a distinguished road
Re: SendGrid API for SMTP emails

Quote:
Originally Posted by sonic8 View Post
There is a sample for using the SendGrid-API with VBA available right here on AWS.
We are no longer going to use Exchange Server for emailing from Access.
I have no idea how to alter my two blocks of code which is working:

Code:
Private Sub btnEmail_Click()

Dim rs As Recordset
Dim uq As String
Dim oApp As Object
Dim var As String

    Set oApp = GetObject(, "Outlook.Application")
    If Err <> 0 Then
         Set oApp = CreateObject("Outlook.Application")
        Started = True
    End If
On Error Resume Next

Set rs = CurrentDb.OpenRecordset("qryContactsEmailClient", dbReadOnly)
  If Not (rs.EOF And rs.BOF) Then
  rs.MoveFirst
     Do Until rs.EOF = True
        Set oItem = oApp.CreateItem(olMailItem)
        With oItem
            .Body = "This is a system-generated e-mail, please do not reply unless changes are needed to your Name." & vbNewLine & _
                          " " & vbNewLine & _
                          " " & vbNewLine & _
                    "Dear " & rs!FirstName & "," & vbNewLine & _
                          " " & vbNewLine & _
                          " " & vbNewLine & _
                    "Please carefully review your complete name below as it will appear on your printed certificate:" & vbNewLine & _
                          " " & vbNewLine & _
                          " " & vbNewLine & _
                    "" & rs!FirstName & " " & (rs!MiddleName + " ") & rs!LastName & " " & vbNewLine & _
                          " " & vbNewLine & _
                    "Thank you, GCDF Staff"
        .From = "GCDF"
        .To = rs!fldEmailAddress
        .Subject = "Test - Matt please reply"
        .send
With CurrentDb.CreateQueryDef("", "UPDATE Applicants set Applicants.EmailedToClient = -1, Applicants.DateEmailedClient = Now() WHERE Applicants.[GCDF No] = @1")
.Parameters(0) = rs(0)
.Execute
End With
        End With
        rs.MoveNext
        Loop
  Else
    MsgBox "There are no records in the recordset."
  End If
    rs.Close
    Set rs = Nothing
     Set oItem = Nothing
       If Started Then
           oApp.Quit
    End If
    DoCmd.Close acForm, "f_Admin_Main"
        MsgBox "Emails have now been sent to listed individuals."
End Sub
Code:
Private Sub btnEmail_Click()

Dim updateSent As String

DoCmd.SendObject acSendQuery, "qryContactsPrinter", acFormatXLS, "campbell@nbcc.org", , , "GCDF Email Example to Printing Company", "Please review your data below for accuracy"

DoCmd.SetWarnings False
updateSent = "UPDATE Applicants set Applicants.EmailedToPrinter = -1, Applicants.DateEmailedPrinter = Now() WHERE Applicants.EmailedToPrinter = 0"
DoCmd.RunSQL updateSent
DoCmd.SetWarnings True

MsgBox "Excel Spreadsheet has been emailed to the printing company."
DoCmd.Close acForm, "f_Admin_Main_Printer"
End Sub

BennyLinton is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Access used to sent emails from Lotus Notes emails not saved in Sent folder. Ajit Singh Modules & VBA 1 02-07-2016 10:55 PM
E-mail with SMTP The_Doc_Man General 5 01-05-2015 08:47 AM
Email Without SMTP abbaddon223 Modules & VBA 5 09-09-2013 04:35 AM
SMTP usage with LAN.... sjl Modules & VBA 4 06-18-2009 07:50 PM
SMTP - Arrrgh Smudger Smith Modules & VBA 9 07-10-2008 05:31 AM




All times are GMT -8. The time now is 02:01 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World