473,386 Members | 1,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

PHP Mail() and versions

I'm using PHP 5 at home w/Apache & MySQL on a test system where I
write through a form to a database and also send an email to people on
a drop down list. Purpose for this is an electronic log at work where
an email goes out to let a person know an entry has been made with a
copy of the text on that email. Works fine on my test system at home
but not at work. I'm trying to remember which version of PHP I'm
using there and I'm thinking it's an early 4.x version (4.1 maybe).

A couple of questions come to mind. Assuming that it is in fact, the
early 4.x version that's responsible (because I'm not sure when the
mail() function came into being (which PHP version), would it be
possible to just copy a later folder version of PHP onto the version
at work? I suppose if I dropped version 5 folder on top of the
existing version 4 and it didn't work, I could just reverse that
process and put my earlier version of 4.x back to get back to where I
was... OR, is using something like phpmailer a better option?

thanks very much for any pointers,

cov
Feb 24 '07 #1
6 1954
On Feb 24, 5:13 am, cover <coverlandNOSPAM...@yahoo.comwrote:
I'm using PHP 5 at home w/Apache & MySQL on a test system where I
write through a form to a database and also send an email to people on
a drop down list. Purpose for this is an electronic log at work where
an email goes out to let a person know an entry has been made with a
copy of the text on that email. Works fine on my test system at home
but not at work. I'm trying to remember which version of PHP I'm
using there and I'm thinking it's an early 4.x version (4.1 maybe).

A couple of questions come to mind. Assuming that it is in fact, the
early 4.x version that's responsible (because I'm not sure when the
mail() function came into being (which PHP version), would it be
possible to just copy a later folder version of PHP onto the version
at work? I suppose if I dropped version 5 folder on top of the
existing version 4 and it didn't work, I could just reverse that
process and put my earlier version of 4.x back to get back to where I
was... OR, is using something like phpmailer a better option?

thanks very much for any pointers,

cov
Dear Cover,

mail() exists much longer than 4.1. Only thing which changed in 4.3 is
the support for smtp_port. Have a look at the manual:

http://at.php.net/manual/en/ref.mail.php

It's more likely that your operating system is the problem, what are
you using? Is the path to sendmail configured correctly? Do you have
sendmail at all? Etc....

Good luck

Martin
------------------------------------------------
online accounting on bash bases
Online Einnahmen-Ausgaben-Rechnung
http://www.ea-geier.at
------------------------------------------------
m2m server software gmbh
http://www.m2m.at

Feb 24 '07 #2
On 23 Feb 2007 22:07:55 -0800, "Martin Mandl - m2m tech support"
<ma**********@gmail.comwrote:
>Dear Cover,

mail() exists much longer than 4.1. Only thing which changed in 4.3 is
the support for smtp_port. Have a look at the manual:

http://at.php.net/manual/en/ref.mail.php

It's more likely that your operating system is the problem, what are
you using? Is the path to sendmail configured correctly? Do you have
sendmail at all? Etc....

Good luck

Martin
Thanks Martin, I'm using XP on both machines and to be honest with
you, I'm not real familiar with 'sendmail'. Having read references to
it in various code snips but haven't read anything comprehensive
enough to help me understand what it is and where it is. I.e. I
haven't located a subfolder for 'sendmail' or a sendmail.exe file for
example.

My php.ini look like this:
--------------------------------------------
[mail function]
; For Win32 only.
SMTP = mail.bigfoot.com
smtp_port = 25

; For Win32 only.
;sendmail_from = ad***@maint.com
-------------------------------------------

Page code looks like this:
-----------------------------------------------------------
/* $to = stripslashes($to); */
$to = stripslashes($to)."\r\n";
$subject = stripslashes($subject);
$text = stripslashes($text);
/* mail('$to',$subject, $text); */
mail($to, $subject, $text, "From: ad***@localhosthome.com");
}

mysql_close();
------------------------------------------------------------

Again, this code works well at my home test machine.
Feb 25 '07 #3
cover wrote:
Thanks Martin, I'm using XP on both machines and to be honest with
you, I'm not real familiar with 'sendmail'. Having read references to
it in various code snips but haven't read anything comprehensive
enough to help me understand what it is and where it is. I.e. I
haven't located a subfolder for 'sendmail' or a sendmail.exe file for
example.
sendmail is a mailserver program (MTA), you can find a microsoft version of it
at http://www.indigostar.com/sendmail.htm
My php.ini look like this:
--------------------------------------------
[mail function]
; For Win32 only.
SMTP = mail.bigfoot.com
smtp_port = 25
As microsoft don't have any MTA by default installed, it's required to use an
external mailer, it's quite important to configure this with right smart host
for the client, as nowadays ISPs only allows users to use their SMTP from the
same network.

Using mail.bigfoot.com may work for you at home, but on the remote server
using it as smarthost may not be possible as they aren't on the same network.
--

//Aho
Feb 25 '07 #4

"cover" <co****************@yahoo.comwrote in message
news:bm********************************@4ax.com...
| On 23 Feb 2007 22:07:55 -0800, "Martin Mandl - m2m tech support"
| <ma**********@gmail.comwrote:
|
| >Dear Cover,
| >
| >mail() exists much longer than 4.1. Only thing which changed in 4.3 is
| >the support for smtp_port. Have a look at the manual:
| >
| >http://at.php.net/manual/en/ref.mail.php
| >
| >It's more likely that your operating system is the problem, what are
| >you using? Is the path to sendmail configured correctly? Do you have
| >sendmail at all? Etc....
| >
| >Good luck
| >
| Martin
|
| Thanks Martin, I'm using XP on both machines and to be honest with
| you, I'm not real familiar with 'sendmail'. Having read references to
| it in various code snips but haven't read anything comprehensive
| enough to help me understand what it is and where it is. I.e. I
| haven't located a subfolder for 'sendmail' or a sendmail.exe file for
| example.

here's what i use. it works either on linux or on windows (iis included).
here's how you'd call it:
(note that your drop directory would be c:/inetpub/mailroot/pickup/ ...
also, remove the last argument - it is using sendmail in this case)

email::send(
$site->adminEmail ,
$site->adminEmail ,
'' ,
'' ,
$site->title . ' - Security Alert' ,
'' ,
$html ,
$site->title ,
$site->rootDirectory . 'images/email.logo.jpg' ,
$site->mailDropDirectory ,
'/usr/sbin/sendmail -ti < '
);
and here's the actual class...sends either plain text and/or html:
(you can add attachments to emails with *slight* modification and, notice
that the company logo *is* an attachment...you'd just add another argument,
encode the file(s) to be attached, and add another boundry for each...no
big.)

hth.

<?
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);
@unlink($fileName);
return $mail;
}
}
?>
Feb 25 '07 #5

"J.O. Aho" <us**@example.netwrote in message
news:54*************@mid.individual.net...
| cover wrote:
|
| Thanks Martin, I'm using XP on both machines and to be honest with
| you, I'm not real familiar with 'sendmail'. Having read references to
| it in various code snips but haven't read anything comprehensive
| enough to help me understand what it is and where it is. I.e. I
| haven't located a subfolder for 'sendmail' or a sendmail.exe file for
| example.
|
| sendmail is a mailserver program (MTA), you can find a microsoft version
of it
| at http://www.indigostar.com/sendmail.htm
|
|
|
| My php.ini look like this:
| --------------------------------------------
| [mail function]
| ; For Win32 only.
| SMTP = mail.bigfoot.com
| smtp_port = 25
|
| As microsoft don't have any MTA by default installed, it's required to use
an
| external mailer, it's quite important to configure this with right smart
host
| for the client, as nowadays ISPs only allows users to use their SMTP from
the
| same network.

AHO !!! while ms might now have an mta installed by default, the ONLY
version WITHOUT one is XP HOME EDITION. all they have to do is install IIS
(which he already has done) and make sure they select SMTP server as a
component of IIS to install.

a more TRUE statement is that windows does NOT come with a POP3 service.
there are several on the web for free...or, if they already have exchange
installed, neither smtp nor pop3 are an issue. he'll just need to know where
to drop his email on his system.

| Using mail.bigfoot.com may work for you at home, but on the remote server
| using it as smarthost may not be possible as they aren't on the same
network.

again, it's all in how you configure your own server. my prototyping system
is windows xp pro. my production servers are all linux. the only problem
i've ever had with using php and email is when i use php's default mail
function. you've just described one of the problems, however there is no
need to use a remote server to do any emailing.

cheers
Feb 25 '07 #6
Steve wrote:
all they have to do is install IIS
(which he already has done) and make sure they select SMTP server as a
component of IIS to install.
Are you sure? He only mentions whats on his machine, which is apache, which
don't need IIS to be installed to work.

| Using mail.bigfoot.com may work for you at home, but on the remote server
| using it as smarthost may not be possible as they aren't on the same
network.

again, it's all in how you configure your own server. my prototyping system
is windows xp pro. my production servers are all linux. the only problem
i've ever had with using php and email is when i use php's default mail
function. you've just described one of the problems,
Can't say the OP did provide much information, so you need to start somewhere.

however there is no need to use a remote server to do any emailing.
Even if it's possible to send email with telnet (sockets), it may not be the
best solution and if you don't use sockets and you don't have a simple MTA (or
you choose to not use one), a remote MTA is quite sensible to use.
--

//Aho
Feb 25 '07 #7

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

Similar topics

8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
8
by: Squirrel | last post by:
Hi everyone, I've created a mail merge Word doc. (using Office XP) , the data source is an Access query. Functionality I'm attempting to set up is: User sets a boolean field to true for...
2
by: JackBlack | last post by:
Using VS.Net 2k3, 2.0 Framework installed... So, I'm sitting here trying to do a very basic SMTP mailer, and I'm struggling with getting either System.Web.Mail (1.1) to work, or System.Net.Mail...
11
by: Dennis | last post by:
I am using the following code that I got from this newsgroup to start a user's default e-mail editor and it works ok. However, I would like to attach a file to the editor (like using word as...
4
by: cover | last post by:
In my PHP 5.0 at home, I'm using the following code to successfully write to a database and also send out an email. For some reason, when I take this code to work, it still writes to the database...
10
by: Frank | last post by:
Hi, I am hoping to find out the differences between the System.Net.Mail and System.Web.Mail. Can some nice folks post the differences; or some urls which show the differences? Great Thanks...
9
by: ARC | last post by:
In case anyone has ran into this yet. The following code used to work with older versions of the MS Outlook library, but would error out in 2007: Dim objOutlook As Outlook.Application Dim...
14
by: Jeff | last post by:
I'm writing my php "form mail" script. Does mail do any checking for header injection in the "to" and "subject" parameters? CR and/or LF? It seems to me it easily could and should, but does it?...
14
by: Warren Tang | last post by:
Hi I am using the mail function to send a mail like this: $b = mail("my_real_email_address@gmail.com", "Hello from PHP", "Hi, finally sent an email successfully"); But it failed. Could you...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.