473,748 Members | 9,913 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fyi - combination of outlook and php - create stationery for MS outlook using PHP engine ;-)

Hi Folk

Some of my clients asked me to create "fancy emails" for them (aka html
formatted emails).

I know how to make a nice html document, but I had trouble creating a simple
way to provide the document to my clients so that they could use it to.

I know most of them use Outlook XP or Outlook 2003, so what I created was a
page that creates a Visual Basic script that, when saved to the desktop and
clicked (run), opens a message in outlook using the html provided.

To see this in action, please go to :

http://www.rakau.com/station/index.php

I would love to have some feedback.

Nicolaas

Mar 22 '06 #1
6 3689
Worked on:
Operating System: Windows 2000 Professional (5.0, Build 2195) Service
Pack 4
Language: German (Regional Setting: German)
MS Office Word 2003 (11.5604.5606)

Feedback:
Subject, and `to:' e-mail address will be fine

Mar 22 '06 #2
windandwaves wrote:
Hi Folk

Some of my clients asked me to create "fancy emails" for them (aka html
formatted emails).

I know how to make a nice html document, but I had trouble creating a simple
way to provide the document to my clients so that they could use it to.

I know most of them use Outlook XP or Outlook 2003, so what I created was a
page that creates a Visual Basic script that, when saved to the desktop and
clicked (run), opens a message in outlook using the html provided.

To see this in action, please go to :

http://www.rakau.com/station/index.php

I would love to have some feedback.
Nicolaas



So - what does this have to do with PHP, and why are you posting this in
a PHP newsgroup?

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Mar 22 '06 #3
Jerry Stuckle wrote:
[....]

So - what does this have to do with PHP, and why are you posting this
in a PHP newsgroup?


Because ultimately it is a PHP application. The code is below. It may give
some people some ideas or help someone I thought (obviously more aimed at
beginners):

<?php
if($_POST["submit"]) {
//clean input
if(!$_POST["filename"]) {
$_POST["filename"] = "test";
}
$filename = alpha_numeric_m ake_one($_POST["filename"]).'.vbs';
$i = 0;
while(file_exis ts($filename)){
$i++;
$filename = $i.'_'.$filenam e;
}
if(!$_POST["html"]) {
$_POST["html"] = example_text();
}
$data = createvbscript( $_POST["html"]);
$length = strlen($data);
if($length > (1024 * 4)) {
die("file is too large - sorry");
}
//create file
if (!$handle = fopen($filename , 'w+')) {
echo "Cannot open file ($filename)";
exit;
}
if (fwrite($handle , $data) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
fclose($handle) ;
//force download
@ob_end_clean() ;
header("Pragma: public");
header("Expires : 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename="'.$fi lename.'"' );
header("Content-Type: application/force-download");
// Length required for Internet Explorer
header("Content-Length: ".$length);
echo $data;
flush();
@ob_flush();
}
else {
$v = '<h1>create outlook stationery</h1>
<div id="explanation ">
<p>This page creates a macro from an html file. The macro can be used by
people with Windows XP and Microsoft Office XP to write <i>fancy emails</i>.
This page may particularly useful for IT professionals with clients who
are interested in sending <i>html formatted</i> emails.</p>
<p>Please copy an html file below, keeping the following in mind:</p>
<ul>
<li>keep it simple</li>
<li>place all styles in elements (e.g. write <i>&lt;p style=&quot;mar gin:
10px;&quot;&gt; </i>)</li>
<li>do not put styles in the header or the body tag, because these are
most likely to be removed by mail programs</li>
<li>make absolute references to external (image) files (e.g.
<i>http://www.mysite.com/logo.gif</i> rather than <i>logo.gif</i>)</li>
<li><a href="http://validator.w3.or g">validate</a> your file before
submitting it</li>
<li>do not use lightly coloured fonts (e.g. white) or dark backgrounds
(e.g. black), because the person may reply without the background colour or
without the font colour. </li>
<li><b>only works for people with Windows XP and MS Office XP</b> -
please let me know if you need a different format and I will endeavour to
create it.</li>
<li>to see an example, just enter a filename and leave the html field
blank.</li>
<li>the maximum file size for this example is 2Kb.</li>

</ul>
</div>
<h1>enter details below</h1>
<div id="former">
<form method="post" action="index.p hp">
<p>
html document: <br />
<textarea cols="50" rows="20" name="html"></textarea>
<br />file name:<input name="filename" />
<br /><input type="submit" name="submit" value="create VB Script macro
for fancy formatted email" id="submit" />
</p>
</form>
</div>
<h1>example html document</h1>
<div id="sampler">
<pre>'.htmlenti ties(example_te xt()).'</pre>
</div>
';
}
$html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>create outlook stationery</title>
<link rel="icon" href="http://www.sunnysideup .co.nz/i/favicon.ico"
type="image/ico" />
<link rel="shortcut icon"
href="http://www.sunnysideup .co.nz/i/favicon.ico" />
<link href="s/s.css" rel="stylesheet " type="text/css" />
<meta name="keywords" content="create outlook stationery" />
<meta name="descripti on" content="create outlook stationery" />
</head>
<body>
<div id="title">
<img src="i/logo.gif" alt="Sunny Side Up - Stationery it" title="Sunny
Side Up - Stationery it" width="720" height="140" />
</div>
'.$v.'
</body>
</html>';
echo $html;

function createvbscript( $s) {
$s = str_replace('"' , '" & chr(34) & "', $s);
$s = str_replace("\r ", ' ', $s);
$s = str_replace("\n ", ' ', $s);
$s = str_replace(' ', ' ', $s);
$v = '
Dim theApp
Set theApp = WScript.CreateO bject("Outlook. Application")
CreateHTMLMail( theApp)

Public Sub CreateHTMLMail( olapp)
Dim objMail
Set objMail = olApp.CreateIte m(olMailItem)
With objMail
.BodyFormat = 2
.HTMLBody = "'.$s.'"
.Display
End With
End Sub';

return $v;

}
function alpha_numeric_m ake_one ($s) {
//replaces all non alpha-numeric entries
if($s) {
$s = eregi_replace("[^[:alnum:]]", " ", $s);
$s = trim(eregi_repl ace(" +", "", $s)); //removes excess spaces
return $s;
}
return false;
}

function example_text() {
return '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<title>sexy message from me</title>
</head>
<body style="backgrou nd-color: #D4D0C8; padding: 0px; margin: 0px auto 0px
auto;">
<div id="container" style="backgrou nd-color: #D4D0C8; padding: 0px;
margin-left: auto; margin-right: auto;" align="center">
<div id="main" style="backgrou nd-color: white; margin: 0px auto 0px
auto; width: 380px; padding: 20px;" align="Center">
<p style="padding: 0px; margin: 0px; text-align: center; color:
#333333; ">
<br>
double-click to edit
<br>
</p>
</div>
</div>
</body>
</html>';
}

?>
Mar 22 '06 #4
Johannes Matjeschk wrote:
Worked on:
Operating System: Windows 2000 Professional (5.0, Build 2195) Service
Pack 4
Language: German (Regional Setting: German)
MS Office Word 2003 (11.5604.5606)

Feedback:
Subject, and `to:' e-mail address will be fine


Thank you for your feedback. What exactly do you mean?
Mar 22 '06 #5
windandwaves wrote:
Jerry Stuckle wrote:
[....]
So - what does this have to do with PHP, and why are you posting this
in a PHP newsgroup?

Because ultimately it is a PHP application. The code is below. It may give
some people some ideas or help someone I thought (obviously more aimed at
beginners):


<snip>

OK, and your PHP question is...?

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Mar 22 '06 #6
Jerry Stuckle wrote:
windandwaves wrote:
Jerry Stuckle wrote:
[....]
So - what does this have to do with PHP, and why are you posting
this in a PHP newsgroup?

Because ultimately it is a PHP application. The code is below. It
may give some people some ideas or help someone I thought (obviously
more aimed at beginners):


<snip>

OK, and your PHP question is...?


It was not really a question, but as I understand it, a message board can
also be used to make announcements or share ideas, not just ask questions.
i ask a lot of questions, but when I make something I like to share it,
because I want to be stay ahead of the karma police ;-) I have had so many
awesome responses over the last year, that I would love to add something
myself.

I try to make my subject lines as informative as possible so that people can
ignore it if they have no interest.
Nicolaas

Mar 22 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4855
by: Bruce | last post by:
Has anyone tried sending web pages containing javascript to another user also using Outlook Express? Mine don't work on the other end - although I'm not sure if this is because they don't have Javascript enabled in MS Explorer 6. I save the entire HTML file + script into my Stationery folder. Then I select Message/New Message Using . Should it work?
3
7963
by: scott | last post by:
Anyone have a link to syntax that could create an outlook vcard file format? all examples i find are for doing it inside outlook with .net. i'm just looking for an ASP solution.
4
17481
by: lauren quantrell | last post by:
Is there a way to open the MS Outlook address book using VBA and then be able to do something with the return value? I want users to click an icon to open the Outlook address book then when an address is selected, populate an Access field with the address. Is this remotely possible? Thanks, lq
3
4537
by: Jyothi | last post by:
Hi All, Thanks for ur reply for my previous postings. I have a question. I wanted to show the outlook inbox in a window with minimal options like send,delete,reply,forward,replytoall,new message. how do i achieve that. Is there any option in C# where i can perform this using the native support of .NET framework?
1
1859
by: DotNetJunkies User | last post by:
I wonder if someone could tell me how to open outlook by code and add a ny contact folder, and insert a email account /Mathias --- Posted using Wimdows.net NntpNews Component - Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.
2
2669
by: HvG | last post by:
I'm sure this is a trivial question, but I cannot create an Outlook Object from a WebForm app, but can from a console app. or a Windows app. My COM knowledge is very poor sorry. Code----------------------------------------------------------------------------------- Dim oApp As Outlook.Application = New Outlook.Application .... ----------------------------------------------------------------------------------- Exception Details:...
1
47498
by: Michele | last post by:
Hi, I need to send the same Email to different people. I'm using Outlook XP and VB.Net. I tryed with the following code: Dim oOutL As Outlook.Application Dim oMail As Outlook._MailItem oOutL = CreateObject("outlook.application") For i = 0 To Email.Length - 1
2
2237
by: John | last post by:
Hi I am trying to find the way to create an email in outlook. I am using the code given at the end. It works fine the first time but calling the code second time gives the following error; Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW can...
4
4572
by: Nicole | last post by:
I found this code below to use to send emails using VB with Outlook. However, it gives these errors. 'Send' is ambiguous across the inherited interfaces 'Outlook._MailItem' and 'Outlook.ItemEvents_Event'. Name 'olByReference' is not declared. Name 'olMailItem' is not declared. Name 'olTo' is not declared. How could i edit this code to get it to work?
0
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9316
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9241
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8239
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4597
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.