noodleNT
asked on
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.
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.
ASKER
orglib is the Organizational Forms Library?
ASKER
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$
ASKER
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$.
They will be working for the $Department$ Department out of the $Office$ office. Their position is $Position$.
ASKER
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.
ASKER
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?
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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! :)
Also... I cant seem to figure out how to Hide the template in the OFL.
Thanks man! This is going to kick butt! :)
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
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
ASKER
This blew my boss away!!!
THANKS!!!
THANKS!!!
Do we share the raise? ;-)
Stefri
Stefri
ASKER
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!
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!
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
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
ASKER
It does work for the link. Get rid of the < > and it works fine.
No kidding, I will try tomorrow at office. Does it handle the extra spaces in Publi Folders/All Public Folders
Stefri
Stefri
ASKER
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.
I tested it, not wotking
ASKER
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.Temp lates - New Employee Setup Request")
Set AlertMessage2 = AlertFolder.Items.Add("IPM .Note.Temp lates - 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_M anager$", HiringManager,1)
tmpBody = Replace(tmpBody,"$ItemStat us$", ItemStatus,1)
tmpBody = Replace(tmpBody,"$Departme nt$", Department,1)
tmpBody = Replace(tmpBody,"$Office$" , Office,1)
tmpBody = Replace(tmpBody,"$Position $", Position,1)
tmpBody = Replace(tmpBody,"$Requeste r$", Requester,1)
tmpBody = Replace(tmpBody,"$PublicFo lder$", 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.
Set AlertFolder = g_oNS.GetDefaultFolder(6) 'olFolderInbox
Set AlertMessage1 = AlertFolder.Items.Add("IPM
Set AlertMessage2 = AlertFolder.Items.Add("IPM
'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$
tmpBody = Replace(tmpBody,"$Employee
tmpBody = Replace(tmpBody,"$Employee
tmpBody = Replace(tmpBody,"$Hiring_M
tmpBody = Replace(tmpBody,"$ItemStat
tmpBody = Replace(tmpBody,"$Departme
tmpBody = Replace(tmpBody,"$Office$"
tmpBody = Replace(tmpBody,"$Position
tmpBody = Replace(tmpBody,"$Requeste
tmpBody = Replace(tmpBody,"$PublicFo
tmpBody = Replace(tmpBody,"$PFLink$"
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.
ASKER
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.
in a plaint text message or RTF, accessing the item is <outlook://path to folder/~subject>
stefri
stefri
ASKER
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?
<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?
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