• setting from in an email (visual basic)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » setting from in an email (visual basic)

    Author
    Topic
    #448547

    Is there a way to edit the code below to set who the email is from? The from in the email would be the same email address everytime. Obviuosly .from does not work. Any ideas? Thanks…

    Set objDoc = objWord.Documents.Open(“c:tempword.doc”)
    With objDoc.MailEnvelope.Item
    .To = Nz(srt, “”)
    .Subject = strSubject
    ‘.From = “something@aol.com” Set emai address
    .Send

    Viewing 0 reply threads
    Author
    Replies
    • #1097177

      Outlook does not let you set the sendername (because of SPAM) but will let you set the sentonbehalfofname if you have appropriate permissions.

      • #1097201

        Is there a way to allow outlook to open before sending the email and allow the user to set the from and the send the email? Even if they had to press the send button that would be ok..

        With objDoc.MailEnvelope.Item
        .To = Nz(srt, “”)
        .Subject = strSubject
        .SentOnBehalfOfName = “gbanks@ets.org”
        .Attachments.Add “c:tempword.doc”
        .Send

        End With

        • #1097211

          No, we already tried .Display and that didn’t work.

          You might go back to automating Outlook – would it be OK to send the Word doc as attachment?

          • #1097265

            Tried that and they wern’t thrilled with it. I could add the text to a table like you mentioned earlier but how do I format it like a letter like they want?

            • #1097279

              It’s getting to be too complicated.

              If you want to send an e-mail based on a Word document, you have to send it from within Word, but as far as I can tell there is no way to set the From address automatically. You could create and display the document and let the user send it manually.

              On the other hand, if it’s OK to send an unformatted message, you can use Outlook automation and set the SentOnBehalfName etc.

            • #1097578

              Hey Hans. I just wanted to give you an update. I was able to get this working uusing sentonbehalfof. Once I got the permissions straightened out with the group mailbox I was good to go. As always thanks for you help and thank to all whp post answers to postings on this board. It really is a god send.

    Viewing 0 reply threads
    Reply To: setting from in an email (visual basic)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: