Question on SendMail object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RLN

    Question on SendMail object

    Re: Access 2003

    I have a line of code in my app that sends an email after these strings
    are populated: gblSendTo, gblEMailSubject , and gblEMailBody.

    DoCmd.SendObjec t , "", "", gblSendTo, "", "", gblEMailSubject ,
    gblEMailBody, False, ""

    Currently, when the email is sent internally in our company, the "From:"
    in the email is my own personal work address.

    I did not see in the syntax (unless I missed it) where the "From:" can
    be set in the "SendMail" object in Access.

    There is a department address we can use as the "From".

    How do I change my code so that when the users see the email sent by the
    app, it shows up as
    "From: <DeptName@compa ny.comand not from "MyName@company .com"?

    Thanks.

    (I don't know if this matters or not, but we useMicrosoft Exchange
    Server for internal email.)



    *** Sent via Developersdex http://www.developersdex.com ***
  • Lars Brownie

    #2
    Re: Question on SendMail object

    I don't think this can be done with SendObject. However, you cán do it with
    Outlook automation, more specifically using the .SendOnBehalfOf property,
    see:



    Lars

    "RLN" <nospam@devdex. comschreef in bericht
    news:1208813425 _120@news.newsf eeds.com...
    Re: Access 2003
    >
    I have a line of code in my app that sends an email after these strings
    are populated: gblSendTo, gblEMailSubject , and gblEMailBody.
    >
    DoCmd.SendObjec t , "", "", gblSendTo, "", "", gblEMailSubject ,
    gblEMailBody, False, ""
    >
    Currently, when the email is sent internally in our company, the "From:"
    in the email is my own personal work address.
    >
    I did not see in the syntax (unless I missed it) where the "From:" can
    be set in the "SendMail" object in Access.
    >
    There is a department address we can use as the "From".
    >
    How do I change my code so that when the users see the email sent by the
    app, it shows up as
    "From: <DeptName@compa ny.comand not from "MyName@company .com"?
    >
    Thanks.
    >
    (I don't know if this matters or not, but we useMicrosoft Exchange
    Server for internal email.)
    >
    >
    >
    *** Sent via Developersdex http://www.developersdex.com ***

    Comment

    • RLN

      #3
      Re: Question on SendMail object


      Thank you for this tip here. I am going to try the code from the link
      you provided.

      I am somewhat new to using the Outlook Object model inside of an Access
      app. If you have any tips or good coding practices for using this this
      specific object model efficiently, I would welcome your suggestions.

      I read in another thread where "SendOnBehalfOf " has a permission that
      has to be granted. Where is this set/modified?

      In my Access app, the "From" address must change before the email is
      sent, only if the current record in the database came from a source
      different than the previous record.


      *** Sent via Developersdex http://www.developersdex.com ***

      Comment

      • lyle fairfield

        #4
        Re: Question on SendMail object

        RLN <nospamrln@devd ex.comwrote in news:1209053070 _367@news.newsf eeds.com:
        I am somewhat new to using the Outlook Object model inside of an Access
        app. If you have any tips or good coding practices for using this this
        specific object model efficiently, I would welcome your suggestions.
        I suggest that you use CDO.

        Comment

        • Lars Brownie

          #5
          Re: Question on SendMail object

          "RLN" <nospamrln@devd ex.comschreef in bericht
          news:1209053070 _367@news.newsf eeds.com...
          >
          Thank you for this tip here. I am going to try the code from the link
          you provided.
          >
          I am somewhat new to using the Outlook Object model inside of an Access
          app. If you have any tips or good coding practices for using this this
          specific object model efficiently, I would welcome your suggestions.
          To use it you must make sure that the Outlook reference in Access is
          checked.
          I read in another thread where "SendOnBehalfOf " has a permission that
          has to be granted. Where is this set/modified?
          In the exchange server the users should have send-as rights on the
          department mailbox.
          In my Access app, the "From" address must change before the email is
          sent, only if the current record in the database came from a source
          different than the previous record.
          In your code you can set the SendOnBehalfOf property or not set it at all on
          the basis of the criteria you mention.

          Lars


          Comment

          • Tony Toews [MVP]

            #6
            Re: Question on SendMail object

            "Lars Brownie" <lars@brownie.c omwrote:
            >To use it you must make sure that the Outlook reference in Access is
            >checked.
            However, given that folks may have different versions of Outlook installed or maybe
            not even have it installed, I'd suggest switching your code to late binding once it's
            working.

            Late binding means you can safely remove the reference and only have an error when
            the app executes lines of code in question. Rather than erroring out while starting
            up the app and not allowing the users in the app at all. Or when hitting a mid, left
            or trim function call.

            For more information including additional text and some detailed links see the "Late
            Binding in Microsoft Access" page at http://www.granite.ab.ca/access/latebinding.htm

            Tony
            --
            Tony Toews, Microsoft Access MVP
            Please respond only in the newsgroups so that others can
            read the entire thread of messages.
            Microsoft Access Links, Hints, Tips & Accounting Systems at

            Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

            Comment

            • Lars Brownie

              #7
              Re: Question on SendMail object

              Thanks for the tip. Didn't know about that.

              "Tony Toews [MVP]" <ttoews@teluspl anet.netschreef in bericht
              news:q2m11455fc dqeqqloi7lnqitu rhc633924@4ax.c om...
              "Lars Brownie" <lars@brownie.c omwrote:
              >
              >>To use it you must make sure that the Outlook reference in Access is
              >>checked.
              >
              However, given that folks may have different versions of Outlook installed
              or maybe
              not even have it installed, I'd suggest switching your code to late
              binding once it's
              working.
              >
              Late binding means you can safely remove the reference and only have an
              error when
              the app executes lines of code in question. Rather than erroring out
              while starting
              up the app and not allowing the users in the app at all. Or when hitting
              a mid, left
              or trim function call.
              >
              For more information including additional text and some detailed links see
              the "Late
              Binding in Microsoft Access" page at

              >
              Tony
              --
              Tony Toews, Microsoft Access MVP
              Please respond only in the newsgroups so that others can
              read the entire thread of messages.
              Microsoft Access Links, Hints, Tips & Accounting Systems at

              Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

              Comment

              Working...