Results 1 to 12 of 12

Thread: e-mail mailer

  1. #1
    Join Date
    Sep 2002
    Posts
    79

    Unanswered: e-mail mailer

    I have a list of e-mail address for different clients in my database. I need to send them all the same e-mail, but, I would like for it to be personal. So the “Dear” salutation will be directed to each individual client but the body of the e-mail will be the same for all of them.

    When I do a mail merge with word, it works, but, how can I send an e-mail doing the same thing? Is there a way to send a miler from word? If so how? If not, whats my best solution for this?

    Any help is greatly appreciated.

  2. #2
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    Great piece of code
    You can modify it any way you want
    If you have 2k sr1 or greater the outlook patch will throw up a message box for each email saying that another program is trying to programatically send email - it is a pain that is why I either use access 2k pre sr1 or the cdo object model for sending meassages

    http://support.microsoft.com/default...b;en-us;209948

    hth

  3. #3
    Join Date
    Sep 2002
    Posts
    79

    Question

    huh?

  4. #4
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    ok you want to go through the email list and email clients but personalize the salutation but the body is the sam

    Go to the link I sent you.

    It is working code to email from access using outlook.

    you can dim (predefine) the body and move through your recordset to email each of the clients that meet the criteria

    go to that link it will help

  5. #5
    Join Date
    Sep 2002
    Posts
    79
    Im sorry, i tried that but it did not do what i wanted. Could you do one for me and attache the file and i can see exactly how it works.


    Is there no way to do this with Mail Merge?

  6. #6
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    The following code is directly from an application I wrote for an engineering company

    You will need to reference the Microsoft Scripting Runtime library
    and the Microsoft Outlook Object Library - if you are using Access 2000

    this code does many things:
    1)It finds a a zip file based on the stored path location of the clientId on a form
    2) it attaches this file to the email
    3)It looks up the email address of the client and that is the send to
    4)it also allows the user to enter another valid email address if desired
    5)it creates the body of the email





    Sub SendMessage(Optional AttachmentPath)
    On Error GoTo mymailerror
    Dim fs As FileSystemObject
    Dim objOutlook As Outlook.Application
    Dim objOutlookMsg As Outlook.MailItem
    Dim objOutlookRecip As Outlook.Recipient
    Dim objOutlookAttach As Outlook.Attachment
    Dim strconemail As String
    strconemail = DLookup("[email]", "tblconmaster", _
    "conid = forms!frmrange!conid")
    Dim mysubject As String
    Set fs = New FileSystemObject


    Dim clientftp As String
    Dim clientfolder As String
    clientftp = DLookup("[ftploc]", "tblauto", "fabid = forms!frmrange!fabid")
    clientfolder = DLookup("[ftpfolder]", "tblauto", "fabid = forms!frmrange!fabid")

    mysubject = "Transmittal Number..." & Forms!frmrange!TranId & _
    "-2003" & "..." & Forms!frmrange!SentFor & "...Job Number..." & _
    Forms!frmrange!JobNum

    mypath = "P:\zip\" & Forms!frmrange!FabId & "\" & _
    Forms!frmrange!TranId & "-2002Transmittal.zip"


    Set objOutlook = CreateObject("Outlook.Application")


    Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

    With objOutlookMsg

    Set objOutlookRecip = .Recipients.Add(strconemail)
    objOutlookRecip.Type = olTo


    Set objOutlookRecip = .Recipients.Add("isd@steeldetailing.com")
    If MsgBox("Are you going to CC another party?", vbYesNo, _
    "CC 3rd Party") = vbYes Then
    Dim strmycc As String
    strmycc = InputBox("Enter One additional CC", "Add CC to List")
    Set objOutlookRecip = .Recipients.Add(strmycc)
    Else
    objOutlookRecip.Type = olCC
    End If


    .Subject = mysubject
    mybodyadd = InputBox("Additional notes", "ISD Email Module")
    .Body = "There are attachments with this email." & vbCrLf & vbCrLf & _
    mybodyadd & vbCrLf & vbCrLf & "The Drawings found " & _
    "in " & Forms!frmrange!ZipName & _
    ".zip may also be " & _
    "retrieved at the following location:" & _
    "ftp://" & clientftp & clientfolder
    .Importance = olImportanceHigh 'High importance

    If Not IsMissing(mypath) Then
    Set objOutlookAttach = .Attachments.Add(mypath)
    End If
    If MsgBox("Attach the complete Zip file?", vbYesNo, _
    "All files?") = vbYes Then
    mypath = "P:\zip\" & Forms!frmrange!FabId & _
    "\" & Forms!frmrange!ZipName & ".zip"
    Set objOutlookAttach = .Attachments.Add(mypath)
    Else
    End If
    .Send

    End With
    Set objOutlookMsg = Nothing
    Set objOutlook = Nothing
    MsgBox "Your email has been sent to " & strconemail
    mymailerror:
    If Err.Number = 0 Then
    Exit Sub
    Else
    MsgBox Err.Number & vbCrLf & vbCrLf & Err.Description
    Resume Next
    End If

    End Sub

  7. #7
    Join Date
    Sep 2002
    Posts
    79
    Not what i am looking for.

    I just want to send a simple mailer. Body of the e-mail is the same for all clients, but the "Dear" salutaion is directed to each individual.

  8. #8
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    This may not be verbatim what you are looking for - but in reality this is exactly the solution you need

    you can paste the contents of the letter

    into the body - using code
    or dim the .body as a string and place the contents in the body - there are at leat 3 - 5 ways to place the text in the body that I know of

    then using code that either looks at an id on a form or using code that loops through a record set you concantonate the salutation and persons name in the beginning of the body and the .send command will email the individual

    You seem to focused with the merge

    You could use vba from word to send the doc, but the code I provided will do what you need

    paste the doc in a richtext format active x control and use vba to copy paste the contents in the body

    trust me - this code works and it is a professional solution.

    HTH
    let me know if I can assist you

  9. #9
    Join Date
    Sep 2002
    Posts
    79
    Thanks for yor help but, I need to be able to do exactly what i need, and the code gives me a million errors, etc.

    I got a different solution - a $20 add on for outlook. It does exactly what i need.

    Thanks for all your help.

  10. #10
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    Alex what was the add-on?

  11. #11
    Join Date
    Sep 2002
    Posts
    79
    Originally posted by axsprog
    Alex what was the add-on?
    the program is called e-mailmerge. it attaches to outlook and lets you import the list and fields from access.

  12. #12
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    Thanks Alex
    sorry I could not give you a quick solution for your needds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •