Sending email directly to Outlook instead through ISP's SMTP server.

Hello

Is it possible to configure Apache or PHP to send an email created via
PHP script directly to MS Outlook on my computer?

Would I need to install a local SMTP server?

I want to avoid using the SMTP server of my ISP. It is only for testing
purposes.

Your help will be appreciated.

Bundy
Bundy [ Fr, 19 Januar 2007 02:19 ] [ ID #1601675 ]

Re: Sending email directly to Outlook instead through ISP's SMTP server.

"Bundy" <bigbadbundy [at] vfemail.net> wrote in message
news:45b01c97$0$6666$9a6e19ea [at] unlimited.newshosting.com...
| Hello
|
| Is it possible to configure Apache or PHP to send an email created via
| PHP script directly to MS Outlook on my computer?

yes...if php is executing on your pc. and, if you massage things a bit.

| Would I need to install a local SMTP server?

that would reduce the number of things you'd have to massage...greatly. what
os are you running?

| I want to avoid using the SMTP server of my ISP. It is only for testing
| purposes.

that's fine. i'd set myself up as my own smtp/pop3/web server. just do your
dns and mx records, install a the software needed for your server, and go to
town.

| Your help will be appreciated.

not a problem...just need to know more about your config before i can give
instructions.
Steve [ Fr, 19 Januar 2007 05:07 ] [ ID #1601678 ]

Re: Sending email directly to Outlook instead through ISP's SMTP server.

"Steve" <no.one [at] example.com> wrote in message
news:VtXrh.765$LK5.327 [at] newsfe04.lga...
|
| "Bundy" <bigbadbundy [at] vfemail.net> wrote in message
| news:45b01c97$0$6666$9a6e19ea [at] unlimited.newshosting.com...
|| Hello
||
|| Is it possible to configure Apache or PHP to send an email created via
|| PHP script directly to MS Outlook on my computer?
|
| yes...if php is executing on your pc. and, if you massage things a bit.
|
|| Would I need to install a local SMTP server?
|
| that would reduce the number of things you'd have to massage...greatly.
what
| os are you running?
|
|| I want to avoid using the SMTP server of my ISP. It is only for testing
|| purposes.
|
| that's fine. i'd set myself up as my own smtp/pop3/web server. just do
your
| dns and mx records, install a the software needed for your server, and go
to
| town.
|
|| Your help will be appreciated.
|
| not a problem...just need to know more about your config before i can give
| instructions.

actually, scratch that. are you just wanting to see what your email is going
to look like...and keep trying until it looks like you want it to? if so,
i've got a quick email class that creates an rfc compliant email and outputs
it to file. all you'd have to do then would be to navigate to it and open it
up (i bet your default association with .eml is outlook express - you can
either change this, or you can file->open from w/n outlook).

if this suffices, i'll post the email class. it is php 5 but, can be made to
work with < 5 easily.

let me know.
Steve [ Fr, 19 Januar 2007 05:15 ] [ ID #1601679 ]

Re: Sending email directly to Outlook instead through ISP's SMTP server.

ok...play with this and see if it helps. there's preformatting in there for
'branding', but you can alter that however you'd like.

cheers.

<?
class email
{
static function send(
$to ,
$from ,
$cc = '' ,
$bcc = '' ,
$subject ,
$text = '' ,
$html = '' ,
$companyName = '' ,
$logo = null ,
$dropDirectory = '' ,
$exec = '' ,
$execOptions = ''
)
{
$messageHtml = $html;
$html = '
<html>
<style>
body
{
background-color : white;
color : black;
font-family : verdana, tahoma, arial, times new
roman, sans-serif;
font-size : 8pt;
margin : 0px;
text-align : left;
}
</style>
<body>
';
if (isset($logo))
{
$image = file_get_contents($logo);
$image = chunk_split(base64_encode($image));
$html .= '
<img alt="' . $companyName . '" border="0px"
src="cid:logo" style="float:right;">
<br>
<br>
<br>
<br clear="all">
';
}
if ($messageHtml == ''){ $messageHtml = '<html><body>' . $text; }
$html .= $messageHtml . '</body></html>';
if ($text == ''){ $text = $html; }
$boundry = '----=' . md5(uniqid(rand()));
$related = '----=' . md5(uniqid(rand()));
$mail = "MIME-Version: 1.0\r\n";
$mail .= "TO: " . $to . "\r\n";
$mail .= "FROM: " . $from . "\r\n";
$mail .= "CC: " . $cc . "\r\n";
$mail .= "BCC: " . $bcc . "\r\n";
$mail .= "Subject: " . $subject . "\r\n";
$mail .= "Content-Type: multipart/related;
boundary=\"$related\"\r\n\r\n\r\n";
$mail .= "--$related\r\n";
$mail .= "Content-Type: multipart/alternative;
boundary=\"$boundry\"\r\n\r\n\r\n";
$mail .= "--$boundry\r\n";
$mail .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
$mail .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$mail .= $text . "\r\n\r\n";
$mail .= "--$boundry\r\n";
$mail .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n";
$mail .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$mail .= $html . "\r\n\r\n";
$mail .= "--$boundry--\r\n\r\n";
$mail .= "--$related\r\n";
$mail .= "Content-Type: image/jpeg\r\n";
$mail .= "Content-ID: logo\r\n";
$mail .= "Content-Disposition: attachment;
filename=\"logo.jpg\"\r\n";
$mail .= "Content-Transfer-Encoding: base64\r\n\r\n";
$mail .= $image . "\r\n\r\n";
$mail .= "--$related--\r\n\r\n";
$mail .= "-- End --\r\n";
$fileName = $dropDirectory . strtoupper(md5(uniqid(rand()))) . '.eml';
file_put_contents($fileName, $mail);
if (!$exec){ return $mail; }
exec($exec . $fileName . $execOptions);
[at] unlink($fileName);
return $mail;
}
}
?>
Steve [ Fr, 19 Januar 2007 05:29 ] [ ID #1601680 ]

Re: Sending email directly to Outlook instead through ISP's SMTPserver.

I will give it a try.

Thanks

Bundy
Bundy [ Fr, 19 Januar 2007 23:02 ] [ ID #1601693 ]
PHP » alt.php » Sending email directly to Outlook instead through ISP's SMTP server.

Vorheriges Thema: a quick question about stats on page
Nächstes Thema: How to filter date from flat file with epoch date/time?