Selasa, 13 Juni 2017

Re: [MS_AccessPros] Sending email from access

 

Hi Crystal,


Now my outlook is working.

So please let's start the task. Definitely you will take me further step by step ahead.

Thank you in advance for your future help and assistance.

The code which i mentioned before are all in message history, please do check them if any modification or amendment is required please mention it.

regards,
Khalid


---In MS_Access_Professionals@yahoogroups.com, <khalidtanweerburrah@...> wrote :

Hi Crystal,

Thanks for replying. I got it that specific mail application such as Outlook is required to send attachments.

I'm trying to configure my Outlook account, its not configuring yet. As soon it is working and OK. I'll return and request you to guide me further.

Thanks again for replying.

Best regards,
Khalid


---In MS_Access_Professionals@yahoogroups.com, <strive4peace2008@...> wrote :

Hi Khalid,

>>"with an attachment <<

unless you automate with a specific mail application such as Outlook, I do not believe you will be able to attach anything. As far as I know, it is not possible to attach files using Application.FollowHyperlink  "mailto:  ....

respectfully,
crystal
 
~ have an awesome day ~

On 6/11/17 9:57 AM, khalidtanweerburrah@... [MS_Access_Professionals] wrote:
Hi Crystal,

First of all sorry for replying much late, as i was engaged on some other issues.

Now the current situation is that my user do not have Microsoft Out Look Express, so he will use some other email probably gmail.

The first task which i need to accomplish is that when a Member/Members birthday occurs on the current date an email be sent to him/them automatically (with an attachment of Happy birthday wish from Society, some image selected and edited to our requirements).

The necessary fields from table "Members" are as follows:
MembershipType-->Text-->3
MemberID-->Number-->Long Integer (PK)
SurName-->Text-->30
GivenName-->Text-->30
GenderStatus-->Text-->15
Dob-->Date/Time, Format-->Short Date, Input Mask-->00/00/0000;0;_ (Date of Birth)

tblElectronicContacts
MemberEmail-->Text-->50

I have already have a Continuous Form "Notification3", which opens on clicking the Label "LabelNotification3" with the Caption "Member's Birthdays Today".

Form "Notification3" Record Source is query "qryHappyBirthday" having Sql:

SELECT Members.MembershipType, Members.MembershipTitle, Members.MemberID, Members.SurName, Members.GivenName, Members.GenderStatus, Members.DesignationSOC, Members.Dob, Members.PlaceOfBirth, tblContactNumbers.TelephoneResidence, tblContactNumbers.MobileNo1, tblElectronicContacts.MemberEmail
FROM (Members INNER JOIN tblContactNumbers ON Members.MemberID = tblContactNumbers.MemberID) INNER JOIN tblElectronicContacts ON Members.MemberID = tblElectronicContacts.MemberID
WHERE (((Month([Dob]))=Month(Date())) AND ((Day([Dob]))=Day(Date())));

I have just put this information may be you ask me about it.

Crystal, please assume that i am a novice so you will have to guide me step by step.

Required your help.

Regards,
Khalid





---In MS_Access_Professionals@yahoogroups.com, <strive4peace2008@...> wrote :

with Application.FollowHyperlink and mailto:, you can use the default email package installed but you won't have as much control over the message. For instance:

   On Error Resume Next
   Application.FollowHyperlink _
      "mailto: TheEmailAddress@...?subject=My Subject " _
      & "&body=whatever you want to say"

better than using spaces would be to use %20 ... for instance:

?subject=My%20Subject

There are other parameters such as cc and bcc that can be specified. The first parameter has "?" before it and the rest then have "&" before them. Line breaks are represented with: %0d%0a

respectfully,
crystal

http://www.MsAccessGurus.com
connect to me, let's build it together
 
~ have an awesome day ~


On 5/14/2017 7:26 AM, John Viescas JohnV@... [MS_Access_Professionals] wrote:
Khalid-

You have to have Microsoft Outlook installed on the machine where the app is running for that code to work.  If you use something else for email, you'll need custom code.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On May 14, 2017, at 2:03 PM, khalidtanweerburrah@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



Hi John,


In need to send emails to members on certain occasions.

For e.g.:

1) Informing Members of Executive Council for a meeting to take place on certain date, place,time etc; this information we may get from a report, or attach a word document (there is no such report currently. The current procedure is sending word doc. via gmail.


2) Informing Members about any event going to take place.


3) I have a form which displays which members have birthday today, so the idea is that they should be sent a birthday wish through email.


At present we do not have out outlook express.


Some time before in past i asked the same question in this group, and got a function from Bill Mosca.

---------------------------------------------------

Public Function Outlook_SendEmail(ByVal strTo As String, _

                                  ByVal strSubject As String, _

                                  ByVal strMsg As String) As Boolean

'Public Function Outlook_SendEmail(ByVal strTo As String, _

 '                                 ByVal strSubject As String, _

  '                                ByVal strMsg As String, _

   '                               ParamArray AttachmentList() As Variant) As Boolean

'Purpose : Automatically send email via late-binding Outlook Automation.

' Call like this:

' Call Outlook_SendEmail("Bill.Mosca@...","Hey there.", _

  "Here is my message","C:\MyFiles\Test1.txt","C:\MyFiles\Test2.txt")

'DateTime : 11/30/2003 12:12

'Author : Bill Mosca, modified by ChrisO to use Array for attachments.

    Dim objOLApp As Object    'Outlook.Application

    Dim outItem As Object    'Outlook.MailItem

    Dim outFolder As Object    'MAPIFolder

    Dim DestFolder As Object    'MAPIFolder

    Dim outNameSpace As Object    'NameSpace

    Dim lngAttachment As Long


    On Error GoTo err_Outlook_SendEmail


    Set objOLApp = CreateObject("Outlook.Application")

    Set outNameSpace = objOLApp.GetNamespace("MAPI")

    Set outFolder = outNameSpace.GetDefaultFolder(6)    'olFolderInbox=6

    Set outItem = objOLApp.CreateItem(0)    'olMailItem=0


    outItem.Body = strMsg

    outItem.Subject = strSubject

    'outItem.To = strTo

    Dim strList As String

    strList = MakeRecptString("MemberEmail", "Members")

    outItem.To = strList


    'With outItem.Attachments

     '   For lngAttachment = LBound(AttachmentList) To UBound(AttachmentList)

      '      .Add AttachmentList(lngAttachment)

       ' Next lngAttachment

    'End With


    outItem.Send

    Outlook_SendEmail = True


exit_Outlook_SendEmail:

    On Error Resume Next

    Set outItem = Nothing

    Set outFolder = Nothing

    Set outNameSpace = Nothing

    Set objOLApp = Nothing

    Exit Function


err_Outlook_SendEmail:

    Select Case Err.Number

    Case 287

        'User stopped Outlook from sending email.

        MsgBox "Email Cancelled.", vbInformation, "DCDS"

    Case Else

        MsgBox "Error " & Err.Number & " (" & Err.Description _

             & ") in procedure Outlook_SendEmail of Module mod_Utilities"

    End Select


    Resume exit_Outlook_SendEmail


End Function

---------------------------------------------------

Function MakeRecptString(strField As String, strTable As String, _

                         Optional varCriteria, Optional varOutFile)

'Purpose  : Concantenate list of recipients in a table.

'DateTime : 12/19/2000 08:24

'Author   : Bill Mosca

'Return   : String for To list.

'Optional : If varOutFile

    Dim strRecpt As String

    Dim strSQL As String

    Dim intFileNum As Integer

    Dim strRename As String

    Dim db As DAO.Database

    Dim rs As DAO.Recordset

    

    strSQL = "Select [" & strField & "] From [" & strTable & "] "

    

    If Not IsMissing(varCriteria) Then

        strSQL = strSQL & "WHERE " & varCriteria

    End If

    

    Set db = CurrentDb

    Set rs = db.OpenRecordset(strSQL)

    If rs.EOF Or rs.BOF Then

        MsgBox "Email List table not found. Process failed"

        Exit Function

    End If

    With rs

        Do While Not .EOF

            strRecpt = strRecpt & .Fields(0) & ";"

            .MoveNext

        Loop

    End With

    

    If Not IsMissing(varOu

(Message over 64 KB, truncated)


__._,_.___

Posted by: khalidtanweerburrah@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (7)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar