Solved

Custom Form Autogen VB email - Insert a Picture to the body?

Posted on 2004-04-20
21
1,020 Views
Last Modified: 2007-12-19
I have a custom for that sends out email alerts when tasks are marked complete. The email alerts are generated in the VB script of the form. I was wondering if there is a way to insert our corporate logo into the email some where?

Here is another thought - Just jumped the point value

Is it possible to wright some HTML code in a text box. Then use that to create an HTML body email. The text box containing the HTML code would also have to grab values stored in the form. These HTML source code text boxes could be saved on a hidden tab or something.
0
Comment
Question by:noodleNT
  • 13
  • 8
21 Comments
 
LVL 13

Expert Comment

by:stefri
ID: 10871382
Have your custom form create a mail based on a template you have saved to Org Lib as hidden item
The script can also replace part of the orglib html body using specific coding such as
$contact$ etc
It is just a question of getting the orglib.HTMLBody then use various replace to loop through your $tags$

The orglib template will also have the Compay logo.

I usually design the OL html body with FrontPage, add images, tables etc then use File/Send
Instead of sending, I save to Drafts, images are mime encoded
Then reopen from Drafts and publish to Orglib

Add method as it applies to the Items object.

Creates a new Outlook item in the Items collection for the folder, and returns the new item. If not specified, the Type of the item defaults to the type of the folder, or to MailItem if the parent folder is not typed.

expression.Add(Type)

expression     Required. An expression that returns an Items collection object.

Type   Optional. Variant. The Outlook item type for the new item. Can be one of the following OlItemType constants: olAppointmentItem, olContactItem, olJournalItem, olMailItem, olNoteItem, olPostItem, or olTaskItem, one of the following OlOfficeDocItemsType constants: olExcelWorkSheetItem, olPowerPointShowItem, or olWordDocumentItem, or any valid message class. Specify the MessageClass to create custom forms.
The MessagClass is the name you give to your form when publishing

Stefri
0
 

Author Comment

by:noodleNT
ID: 10881296
orglib is the Organizational Forms Library?
0
 

Author Comment

by:noodleNT
ID: 10881343
Also do the bodying coding variables have to be the same as the the variable defined in the form? If so can spaces be in theses variables? $No_Spaces$ or $No Spaces$
0
 

Author Comment

by:noodleNT
ID: 10881486
Will this be the correct way to format the body?

They will be working for the $Department$ Department out of the $Office$ office. Their position is $Position$.
0
 

Author Comment

by:noodleNT
ID: 10881612
Alright... I think I am ready to parse out the variables with what is stored from the form..... I am not quite sure how to do that part. BTW.. I didn't relize how involved this was going to be so I increased the point value another 50.
0
 

Author Comment

by:noodleNT
ID: 10882718
Ok... now I am confused.

To use the template do I use the createitemfromtemplate command? If so how do I tell it to use whats in the Orginizational Form Library?
0
 
LVL 13

Accepted Solution

by:
stefri earned 300 total points
ID: 10882954
You had your template published as IPM.Note.myForm (MessageClass) in the Organization Form Library

You just use this name in expression.Add(IPM.Note.myForm)

You may use any words, phrases etc as long as you use them in the replace call

myPosition = item.userproperties.find("TextPosition).value

htmBody = newItem.HTMLBody
tmpBody = Replace(htmBody, "$the string for position to be replaced with$", myPosition, 1)

Stefri

PS: createitemfromtemplate uses an item saved in the file sysem (oft)


0
 

Author Comment

by:noodleNT
ID: 10883014
Should the Template just bee the message body or have the full email send template? (with TO and From fields and what not)

Also... I cant seem to figure out how to Hide the template in the OFL.

Thanks man! This is going to kick butt! :)
0
 
LVL 13

Expert Comment

by:stefri
ID: 10883055
The template is what you want to send. To field may be pre-adressed. From is set at run time using your default mailbox name. The message body is just your standard text with your tags $So ans So$

When you publish, go to Properties Tab and click Use form for responses only; this is not mandatory but it avoid users to pickup designed forms.

Stefri
0
 

Author Comment

by:noodleNT
ID: 10883591
This blew my boss away!!!

THANKS!!!
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 13

Expert Comment

by:stefri
ID: 10886388
Do we share the raise? ;-)
Stefri
0
 

Author Comment

by:noodleNT
ID: 10889954
HEHE.... No raise yet but he keeps thinking about moving me over from support to the development team. ;)

Quick question on the replace function.

I need to insert multiple lines for one veriable. When I do so I get "False" as the result. Since this is HTML do I switch the chr(13) with <br> to get this to work?

Also... Just a note. In another thread I was asking about creating a hyperlink within a VBscript autogenerated email. Well.. you can do it if you use the template. Create the text you want displayed in the template. Then use the create hyperlink option. Instead of putting in the long URL location just put in your variable, say $URL$, you can then replace that in the code using the steps above with the URL you want.  I did this with a simple mailto link which works perfectly. Turns out all my questions are getting solved with your answere here!
0
 
LVL 13

Expert Comment

by:stefri
ID: 10891596
chr(13) with <br> to get this to work? Yes. It may happen yhay you have chr(10) insraed of chr(13)

The last thread was adding a URL to a Public Folder: it will still not work using <outlook://.....>
The HTML, in Outlook, is decoded by IE engine.

Stefri
0
 

Author Comment

by:noodleNT
ID: 10891713
It does work for the link. Get rid of the < > and it works fine.
0
 
LVL 13

Expert Comment

by:stefri
ID: 10892254
No kidding, I will try tomorrow at office. Does it handle the extra spaces in Publi Folders/All Public Folders

Stefri
0
 

Author Comment

by:noodleNT
ID: 10892621
yeah.. it automatically puts the space filler in the URL. I am going to test right now if I can open the item directly instead of going to the folder. I will let you know of the results.
0
 
LVL 13

Expert Comment

by:stefri
ID: 10893287
I tested it, not wotking
0
 

Author Comment

by:noodleNT
ID: 10893635
I set the bodyformat to HTML. Here is my code to generate the email:


      Set AlertFolder = g_oNS.GetDefaultFolder(6) 'olFolderInbox
      Set AlertMessage1 = AlertFolder.Items.Add("IPM.Note.Templates - New Employee Setup Request")
      Set AlertMessage2 = AlertFolder.Items.Add("IPM.Note.Templates - New Employee Setup Request")

      'Body Format
      bfNumber = 2

      HERE1 = "outlook://public folders/all public folders/G. Information Technology/" & _
              "1. ACAS Internal Communications/a. Account Requests - Submitted"

                  If Alert_Disabled = False Then
                        If Alert_Test = True Then
                              MsgBox "Messages Redirected for Testing." , , "TESTING FORM"
                              Email1 = Requester
                        Else
                              Email1 = "ACAS - Human Resources"
                        End If
                        AlertMessage1.To = Email1                        
                        AlertMessage1.Subject = "Pending Account Approval: " & AlertSubject
                        AlertMessage1.FlagStatus = 2
                        AlertMessage1.FlagDueBy = Due
                        AlertMessage1.bodyformat = bfNumber

                        htmBody = AlertMessage1.HTMLbody
                        FullName = FirstName & " " & LastName
                        ItemStatus = "Pending request approval from HR Department"
                        PublicFolder = "This request can be found at Public Folders G.\1.\a."
                        PFLink = HERE1

                        tmpBody = Replace(htmBody,"$Subject$", msgSubject,1)
                        tmpBody = Replace(tmpBody,"$Employee_Name$", FullName,1)
                        tmpBody = Replace(tmpBody,"$Employee_StartDate$", StartDate,1)
                        tmpBody = Replace(tmpBody,"$Hiring_Manager$", HiringManager,1)
                        tmpBody = Replace(tmpBody,"$ItemStatus$", ItemStatus,1)
                        tmpBody = Replace(tmpBody,"$Department$", Department,1)
                        tmpBody = Replace(tmpBody,"$Office$", Office,1)
                        tmpBody = Replace(tmpBody,"$Position$", Position,1)
                        tmpBody = Replace(tmpBody,"$Requester$", Requester,1)
                        tmpBody = Replace(tmpBody,"$PublicFolder$", PublicFolder,1)
                        tmpBody = Replace(tmpBody,"$PFLink$", PFLink,1)

                        AlertMessage1.HTMLbody = tmpBody
                        AlertMessage1.Send
                        MsgBox "The new account information has been sent to HR for approval." , , "Email Sent"
                  End If


Then in the template I created the HERE text then used the create Hyperlink but for the URL i used $PFLinks$.

If you still have problems I can send you the template.
0
 

Author Comment

by:noodleNT
ID: 10893688
BTW... I havent figured out how to open the Item directly yet. I thought I could use the URL and then add Subject.EML but it didnt work.
0
 
LVL 13

Expert Comment

by:stefri
ID: 10901944
in a plaint text message or RTF, accessing the item is <outlook://path to folder/~subject>
stefri
0
 

Author Comment

by:noodleNT
ID: 10903017
So I want to use:
<outlook://path to folder/~subject>

Not:
<outlook://path to folder/subject.EML>

to  open the item directly? Why the "~" ?

Have you had any luck yet with the URL in the template?
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Get an idea of what you should include in an email disclaimer with these Top 5 email disclaimer tips.
If you don't know how to downgrade, my instructions below should be helpful.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now