473,725 Members | 2,118 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1983
On Feb 24, 5:13 am, cover <coverlandNOSPA M...@yahoo.comw rote:
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**********@g mail.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.co m
smtp_port = 25

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

Page code looks like this:
-----------------------------------------------------------
/* $to = stripslashes($t o); */
$to = stripslashes($t o)."\r\n";
$subject = stripslashes($s ubject);
$text = stripslashes($t ext);
/* mail('$to',$sub ject, $text); */
mail($to, $subject, $text, "From: ad***@localhost home.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.co m
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.co m 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.comw rote in message
news:bm******** *************** *********@4ax.c om...
| On 23 Feb 2007 22:07:55 -0800, "Martin Mandl - m2m tech support"
| <ma**********@g mail.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->rootDirector y . 'images/email.logo.jpg' ,
$site->mailDropDirect ory ,
'/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...yo u'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_conten ts($logo);
$image = chunk_split(bas e64_encode($ima ge));
$html .= '
<img alt="' . $companyName . '" border="0px"
src="cid:logo" style="float:ri ght;">
<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=\"$rel ated\"\r\n\r\n\ r\n";
$mail .= "--$related\r\n";
$mail .= "Content-Type: multipart/alternative;
boundary=\"$bou ndry\"\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_conten ts($fileName, $mail);
if (!$exec){ return $mail; }
exec($exec . $fileName . $execOptions);
@unlink($fileNa me);
return $mail;
}
}
?>
Feb 25 '07 #5

"J.O. Aho" <us**@example.n etwrote in message
news:54******** *****@mid.indiv idual.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.co m
| 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.co m 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.co m 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
5477
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 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
8
9521
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 each person for whom a mail merge letter is desired. The query reads address info from the table for each record where is true.
2
1406
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 (2.0) to work. A note on one of the KB articles says that System.Net.Mail is a 2.0 class, so assuming that VS.Net 2K3 can't compile for 2.0, I decide to try System.Web.Mail. Well, no luck there either. The only classes available in System.Web...
11
1838
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 editor) Dim psi As New ProcessStartInfo psi.UseShellExecute = True psi.FileName = "mailto:" & HttpUtility.UrlEncode() & "?subject=" & Subject & "&body=" & Message Process.Start(psi)
4
4487
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 but doesn't send mail so we're (me and the I.T. guy) trying to find out whether it's the difference between PHP 4 or something else with email security. Does anyone here have experience with mail() in PHP 4 to know whether PHP 4 had issues...
10
3960
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 Frank
9
2243
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 objOutlookMsg As Outlook.MailItem Dim objOutlookRecip As Outlook.Recipient Dim objOutlookAttach As Outlook.Attachment Set objOutlook = CreateObject("Outlook.Application") ' Create the message. Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
14
1797
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? Jeff
14
8356
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 guide me to get it work? Regards
0
8888
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
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
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
9176
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
9113
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
8097
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
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
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
3221
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

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.