Sending email with attachments

PhoenixWW

New member
Local time
Today, 12:22
Joined
May 13, 2017
Messages
2
New here so I apologize if this isn't the right place/forum or procedure for posting a question. I basically have code to send an email for a specific "order" filling in all the blanks based on that order. However, I'd like to send attachments. All attachments are saved in a specific folder based on the field "ApplicantFullName" (ApplicantFullName*.* because attachments could be from 1-5 and have any extension). Any help is appreciated...

Private Sub Command1901_Click()
Dim strEmail As String
Dim strBody As String
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim MyTrackingTable As Recordset
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)

'**************************************************************
strEmailV = Developed_Email
strApp = ApplicantFullName
strAlias = AppAlias
strStartDate = StartAttendance
strEndDate = EndDate
strMajor = Major
strDegree = Type_of_Degree_Awarded
strRef = OrderID
strSchool = Institution_Name
strID = Student_ID_Number
strGradDate = Date_of_Graduation
'Start Email Body
'**************************************

strBody = strBody & strSchool & Chr(13)
strBody = strBody & "Attention : Student Records or Registrar's Office" & Chr(13) & Chr(13)
strBody = strBody & "Dear Sir or Madam, " & Chr(13) & Chr(13)
strBody = strBody & "Our office is conducting a verification check on the individual named below. " & _
" We are requesting a confirmation of the applicant's earned degree and/or attendance." & Chr(13)
strBody = strBody & "If you require any additional information and/or documentation from the applicant, please feel free to contact our office." & Chr(13) & Chr(13)
strBody = strBody & " Applicant : " & strApp & Chr(13)
strBody = strBody & " Other Names Used : " & strAlias & Chr(13)
strBody = strBody & " Student ID# : " & strID & Chr(13)
'strBody = strBody & " Date of Birth : " & strDOB & Chr(13)
strBody = strBody & " Dates of Attendance : " & strStartDate & " through " & strEndDate & Chr(13)
strBody = strBody & " Major/Course of Study : " & strMajor & Chr(13)
strBody = strBody & " Degree Earned : " & strDegree & Chr(13)
strBody = strBody & " Date of Graduation : " & strGradDate & Chr(13)
strBody = strBody & " Grade Point Average : " & Chr(13)
strBody = strBody & " Honors " & Chr(13)
strBody = strBody & " Additional Comments : " & Chr(13) & Chr(13)
strBody = strBody & " Your Name & Title : " & Chr(13)
strBody = strBody & " Department : " & Chr(13)
strBody = strBody & " Email : " & Chr(13)
strBody = strBody & " Phone : " & Chr(13)
strBody = strBody & " Fax : " & Chr(13) & Chr(13) & Chr(13) & Chr(13)

'***creates and sends email
With OutMail
.To = strEmailV
.Subject = "Attention : Student Records or Registrar's Office - Education Verification Request for " & strApp & " - [OrderID #" & strRef & "]"
.Body = strBody
'Change Item(1)to the account number that you want to use
.SendUsingAccount = OutApp.Session.Accounts.Item(2)
.Display
End With


Set objEmail = Nothing
End Sub
 
You'll have to use the file system object to list the files and loop around them adding them one at a time using the outlook .AddAttachment method.
A search on here will find you some examples.

Sent from my Nexus 7 using Tapatalk
 

Users who are viewing this thread

Back
Top Bottom