Page 1 of 2 12 LastLast
Results 1 to 15 of 28

Thread: e-mailing

  1. #1
    Join Date
    Sep 2002
    Posts
    79

    Unanswered: e-mailing

    Is there any way to send e-mails directly from access 2000? I have set up a database and will be corresponding via e-mail to clients, and I need a way to send an e-mail to the specific contact in the record.

    Can I send an e-mail directly from access and, is there way to save the e-mail in access incase I need to refer to that e-mail in the future.

    Basically, I would like to be able to send e-mail to a record (the one I am in at that moment) by pushing a button and then, once pushed the “send” button, for the e-mail to be saved – Like in a history page (for a specific record). So, each record in the database would have its own history.

    Hope I’m not being too confusing.

    Any help would be appreciated.

  2. #2
    Join Date
    Feb 2003
    Posts
    15

    Thumbs up Re: e-mailing

    This example runs a query and then send a XLS file

    DoCmd.SendObject acSendQuery, "nameofquery", acFormatXLS, _
    send_To, send_Cc, , _
    "Subject", _
    "message_body"

  3. #3
    Join Date
    Sep 2002
    Posts
    79
    It does not work - What is "nameofquery"? What do I need to do?

  4. #4
    Join Date
    Feb 2003
    Posts
    15
    the example I gave runs a query over a table, and then the result of the query is send in an excel format.

    "nameofquery" is the name of the query you created
    "sendo_to" is the email destination
    "copy_to" email cc
    "subject" subject of email
    "message_body" message text of mail

  5. #5
    Join Date
    Sep 2002
    Posts
    79
    Thanks but that was not what I was looking for. I simply want to send e-mail from Access directly (not for outlook to open) and, for my messages to be saved as a link in that same record once i push "send".

  6. #6
    Join Date
    May 2002
    Location
    Atlanta, GA
    Posts
    117
    Hey Alex,
    You can not just send mail directly from access. However, there is a way around this. Attached is a database that I created that you can look at but it requires a special file that must be referenced in vb. This file was purchased for 30 dollars (well worth the money) and it allows access to communicate directly with a mail server. The site is called www.prestwood.com. Take a look at there site and read about there product, if you would like you can look at my file and see how I manipulated it to track mail. If you have any questions just let me know.
    Attached Files Attached Files

  7. #7
    Join Date
    May 2002
    Location
    Atlanta, GA
    Posts
    117
    Hey Alex,
    Did you have any luck or questions with the reply I gave? Let me know if you need any help.

    Kal

  8. #8
    Join Date
    Nov 2002
    Location
    Sacramento, CA
    Posts
    34

    Arrow Send (HTML Message) using SMTP

    This works great, if you have an SMTP server to use......

    Function SoftwareChange_Emailer()

    SendEmail:
    Dim iMsg
    Dim iConf
    Dim Flds
    Dim strHTML

    Const cdoSendUsingPort = 2

    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")
    Set Flds = iConf.Fields

    ' Set the CDOSYS configuration fields to use port 25 on the SMTP server.
    ' Don't change these lines. Not sure what the connect to, but the have to be there (if you know, let me know)

    With Flds
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "YOUR.SMTP.SERVER.HERE"
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
    .Update
    End With

    ' Build HTML for message body.
    strHTML = "<HTML>"
    strHTML = strHTML & "<HEAD>"
    strHTML = strHTML & "<BODY>"
    strHTML = strHTML & FILL YOUR MESSAGE BODY HERE(in HTML)
    strHTML = strHTML & "<BODY>"
    strHTML = strHTML & "</HTML>"

    ' Apply the settings to the message.
    With iMsg
    Set .Configuration = iConf
    .To = "THEM@SOMEWHERE.COM"
    .From = "WHOEVER@SOMEWHEREELSE.COM"
    .Subject = "FILL SUBJECT HERE"
    .HTMLBody = strHTML
    .Send
    End With

    ' Clean up variables.
    Set iMsg = Nothing
    Set iConf = Nothing
    Set Flds = Nothing

    End Function

  9. #9
    Join Date
    Sep 2002
    Posts
    79
    I want to be able to send different e-mails to different people.

    Ok this is what I want:

    I have a e-mail button on my form – Once I push this button, is there a way for a new window to open with all the current contact e-mail address in the new window. And I type my e-mail and push sent. Once I push send, the window closes. and also, once I push send, for that e-mail that I wrote to be saved somewhere in access for future reference.

    Basically that is what I want to do. It doesn’t have to exactly the way I explained it but, just want to be able to sent mails from access and be able to recall that e-mail in the future.

  10. #10
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    OK when using Outlook

    Hi Alex

    If you can use MS Outlook this will function.

    Assign the following code to a button in a MS-Access form.
    On the same form create a text box called "Mail_Text"

    Optionally you can do the same with .Subject
    In this example I use a single e-mail address. Make your own table and select the whole table or parts from it.

    To store the e-mail after sending it simply append the information to a table with the following fields: "Send_To", "Date", "Subject", "Body" etc.

    Hope this function.

    regards
    Vestigo

    CODE:
    ************************************************** ***

    Private Sub CreateOutlookMail_Click()
    On Error GoTo Error_CreateOutlookMail

    Dim olApp As Outlook.Application
    Dim olMailMessage As Outlook.MailItem

    Dim olRecipient As Outlook.Recipient
    Dim blnKnownRecipient As Boolean
    Dim Mail_To As String


    Mail_To = "btk@vestigo.no"

    Set olApp = New Outlook.Application
    Set olMailMessage = olApp.CreateItem(olMailItem)

    With olMailMessage
    Set olRecipient = .Recipients.Add(Mail_To)
    blnKnownRecipient = olRecipient.Resolve
    .Subject = "A test mail send from MS-Access "
    .Body = [Mail_Text]
    .Send
    End With

    Set olMailMessage = Nothing
    olApp.Quit
    Set olApp = Nothing
    MsgBox "E-mail has been send to: " & Chr(13) & Mail_To, vbInformation, "Message send"

    Exit_CreateOutlookMail_Click:
    Exit Sub

    Error_CreateOutlookMail:
    MsgBox Err.Description
    Resume Exit_CreateOutlookMail_Click
    End Sub

  11. #11
    Join Date
    Sep 2002
    Posts
    79
    It does not work

  12. #12
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    Smile Missing Object Library ?

    That was a short description of eventually error messages !

    Have you installed the required object library ?
    While into the code select "Tools" / "References" find and select "Microsoft Outlook #.# Object Library"

    Attached you will find an extended test version with splittet "Subject", "Hello" field, "Body text" and "Regards field" :-)

    Hope it function now.

    regards
    Vestigo
    Attached Files Attached Files

  13. #13
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    this is on i used to send out a reminder if the job had overrun

    Private Sub Form_Open(Cancel As Integer)
    Dim rs As DAO.Recordset
    Dim email As Outlook.MailItem
    If datetest.Value < Now() - 7 Then
    Set email = CreateObject("Outlook.Application").CreateItem(olM ailItem)
    Set rs = CurrentDb.OpenRecordset("Overdue", dbOpenSnapshot, dbReadOnly)
    DoCmd.RunSQL ("UPDATE OverdueTest SET OverdueTest.[datetest] = Date();")
    While Not rs.EOF
    With email
    .To = rs("firstname") & "." & rs("surname") & "@uk.agimedia.com"
    .Subject = "job overdue: " & rs("DecriptionBrief")
    .Body = rs("DescriptionFull")
    .Send
    End With
    rs.MoveNext
    Wend
    rs.Close
    End If
    End Sub
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  14. #14
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    and to screen it down to the basics for you

    Private Sub Form_Open(Cancel As Integer)
    Dim email As Outlook.MailItem
    Set email = CreateObject("Outlook.Application").CreateItem(olM ailItem)
    With email
    .To = <Email Address>
    .Subject = <Subject Text>
    .Body = <Message>
    .Send
    End With
    End Sub
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  15. #15
    Join Date
    Sep 2002
    Posts
    79
    m.timoney it worked, but, I got a message saying “e-mail sent to Balh Blah@blah.com

    But, when I check the my e-mail, nothing was sent to it.

    Also, I would for the message I wrote to be saved in a table – How can I do that (so I can refer to it in the future).

Posting Permissions

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