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

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.
noodleNTAsked:
Who is Participating?
 
stefriConnect With a Mentor Commented:
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
 
stefriCommented:
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
 
noodleNTAuthor Commented:
orglib is the Organizational Forms Library?
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
noodleNTAuthor Commented:
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
 
noodleNTAuthor Commented:
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
 
noodleNTAuthor Commented:
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
 
noodleNTAuthor Commented:
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
 
noodleNTAuthor Commented:
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
 
stefriCommented:
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
 
noodleNTAuthor Commented:
This blew my boss away!!!

THANKS!!!
0
 
stefriCommented:
Do we share the raise? ;-)
Stefri
0
 
noodleNTAuthor Commented:
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
 
stefriCommented:
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
 
noodleNTAuthor Commented:
It does work for the link. Get rid of the < > and it works fine.
0
 
stefriCommented:
No kidding, I will try tomorrow at office. Does it handle the extra spaces in Publi Folders/All Public Folders

Stefri
0
 
noodleNTAuthor Commented:
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
 
stefriCommented:
I tested it, not wotking
0
 
noodleNTAuthor Commented:
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
 
noodleNTAuthor Commented:
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
 
stefriCommented:
in a plaint text message or RTF, accessing the item is <outlook://path to folder/~subject>
stefri
0
 
noodleNTAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.