I am currently using CDO to send e-mails from Access with VBA using SMTP and it works fine.
My problem is when I use SMTP I do not see the sent e-mails in the sent items in the mailbox that I am using. I need this so I can proof to the recipient that the e-mail was indeed sent. Does anyone one have an idea how I can fix this? Any solution in
VBA (as above) will be welcome. Below is my script in
Const cdoSendUsingPickup = 1 Const cdoSendUsingPort = 2 'Must use this to use Delivery Notification Const cdoAnonymous = 0 Const cdoBasic = 1 ' clear text Const cdoNTLM = 2 'NTLM 'Delivery Status Notifications Const cdoDSNDefault = 0 'None Const cdoDSNNever = 1 'None Const cdoDSNFailure = 2 'Failure Const cdoDSNSuccess = 4 'Success Const cdoDSNDelay = 8 'Delay Const cdoDSNSuccessFailOrDelay = 14 'Success, failure or delay Set objmsg = CreateObject("CDO.Message") Set objConf = CreateObject("CDO.Configuration") Set objFlds = objConf.Fields With objFlds ''http://schemas.microsoft.com/cdo/configuration/ the .Items must pe prefixed with this .Item("sendusing'") = cdoSendUsingPort .Item("smtpserver'") = "126.96.36.199" .Item("smtpauthenticate") = cdoBasic .Item("sendusername") = Username .Item("sendpassword") = Password .Item("smtpserverport") = 25 .Update End With strbody = "Message here" With objmsg Set .Configuration = objConf .To = "firstname.lastname@example.org" .From = "email@example.com" .Subject = "EmailSubject" .HTMLBody = strBody .AddAttachment myfile .Fields("urn:schemas:mailheader:disposition-notification-to") = "firstname.lastname@example.org" .DSNOptions = cdoDSNSuccessFailOrDelay .Fields.Update .Send If Err.Number <> 0 Then Debug.Print Err.Description End If