PHP and Mail

I wanted to share with the community a work around we have developed for using the mail function within PHP when compiled with NSAPI (Iplanet SunOne).
Quick summary of the problem.
Description:
mail() stops working a few minutes after Sunone 6 web server starts,
which makes this look like a resource problem...
Config line: "./configure --with-mysql=/usr/local/mysql
--with-nsapi=/home/netscape/servers --enable-track-vars --enable-libgcc
--with-ldap"
Note that mail() does work briefly after web server is restarted so it
doesn't seem to be a configuration problem.
Reproduce code:
<?php
mail("[email protected]", "Test Subject", "Test Body");
?>
Expected result:
expect to receive an email
Actual result:
no email received
I get no php or system errors but the following error shows up in the
IPlanet logs:
"trying to GET /is/sys
net/test/email.php, php4_execute reports: PHP Warning: mail(): Could
not execute
mail delivery program '/usr/lib/sendmail -t'"
Solution:
Here's a solution that appears to work for us so far. It might be nice
if the php developers would consider a --with-sfio parameter in
configure that took care of this. Our exec command is still broken so
I'll probably have to do this same type of thing for that.
1. install sfio from AT*T
2. setenv LIBS "-L/usr/local/lib/sfio -lsfio"
3. modify ext/standard/mail.c
4. modify /usr/local/include/sfio/sfio.h so references to other sfio
header files are absolute paths (if I use -I/usr/local/include/sfio to
find the files it produces errors for files other than mail.c)
5. run configure and compile as normal
here's a diff or my code and the original mail.c:
diff mail.c mail.c.orig
23c23
< #include </usr/local/include/sfio/sfio.h>
#include <stdio.h>177c177
< Sfio_t *sendmail=NULL;
FILE *sendmail;215c215
< sendmail = sfpopen(sendmail, sendmail_cmd, "w");
sendmail = popen(sendmail_cmd, "w");224c224
< sfclose(sendmail);
pclose(sendmail);228,229c228,229
< sfprintf(sendmail, "To: %s\n", to);
< sfprintf(sendmail, "Subject: %s\n", subject);
fprintf(sendmail, "To: %s\n", to);
fprintf(sendmail, "Subject: %s\n", subject);231c231
< sfprintf(sendmail, "%s\n", headers);
fprintf(sendmail, "%s\n", headers);233,234c233,234
< sfprintf(sendmail, "\n%s\n", message);
< ret = sfclose(sendmail);
fprintf(sendmail, "\n%s\n", message);
ret = pclose(sendmail);This information has also been posted on the PHP forum at
http://bugs.php.net/bug.php?id=28748
We had a heck of a time finding much information about the exec and mail not working on Solaris so we wanted to share this with everyone. Hope it helps someone out!
Cheers,
Ken and David
Kalamazoo College

If you want to send through your mail server you will only need SMTP for sending. You can however also send through your ISP's mail server.
As far as security goes: The most common issue is not PHP's mail function, but the web forms used to call it. If you go for one of the most common Forum SW, you should probably be OK.

Similar Messages

  • PHP Form Mail Scripts

    What is a good resource for pre-made PHP Form Mailer Scripts.
    This is for use with a website hosted on GoDaddy.
    My client has a few requirements that the GoDaddy script does
    not offer (and the script I chose from GoDaddy is uneditable). I
    know nothing about scripting but thought I could use a pre-made
    script and modify it...is that crazy thinking on my part?
    Here are the special requests from my client:
    - They'd like to see the time the form was submitted in EST
    (the GoDaddy script puts the time in military time in another time
    zone in the subject line). Can this appear in the body of the email
    as well as the subject line?
    - They'd like the form to be sent to the person submitting it
    as well as to their company
    - They would like to be able to REPLY TO the email they
    receive with the form submission and have it be addressed to the
    person submitting the form. The current script has the email
    addressed to themselves (the company) if they click REPLY TO, so
    they are replying to themselves
    - Although this has nothing to do with the Form Mailer script
    as far as I can guess, they asked that the person filling out the
    form be able to print it prior to submitting (in my opinion,
    though, if i can have a copy of the submission sent to the
    submitter, there's no reason for this). But if anyone knows how to
    do this, please let me know.
    - Finally, the client wants to know if each submission can
    have a unique tracking number assigned to it.
    Thank you all. Any feedback is appreciated.
    Richard

    Hi,
    I can without any doubt recommend Forms 2 Go:
    http://www.bebosoft.com/products/formstogo/index.php
    Very easy to use and even someone like me who don't know a
    lot of
    programming, use it extensively.
    Deon
    "RichyZee" <[email protected]> wrote in
    news:gcvkac$fcp$[email protected]:
    > What is a good resource for pre-made PHP Form Mailer
    Scripts. This is
    > for use with a website hosted on GoDaddy.
    >
    > My client has a few requirements that the GoDaddy script
    does not
    > offer (and
    > the script I chose from GoDaddy is uneditable). I know
    nothing about
    > scripting but thought I could use a pre-made script and
    modify it...is
    > that crazy thinking on my part?
    >
    > Here are the special requests from my client:
    >
    > - They'd like to see the time the form was submitted in
    EST (the
    > GoDaddy
    > script puts the time in military time in another time
    zone in the
    > subject line). Can this appear in the body of the email
    as well as the
    > subject line?
    >
    > - They'd like the form to be sent to the person
    submitting it as well
    > as to
    > their company
    >
    > - They would like to be able to REPLY TO the email they
    receive with
    > the form
    > submission and have it be addressed to the person
    submitting the form.
    > The current script has the email addressed to themselves
    (the company)
    > if they click REPLY TO, so they are replying to
    themselves
    >
    > - Although this has nothing to do with the Form Mailer
    script as far
    > as I can
    > guess, they asked that the person filling out the form
    be able to
    > print it prior to submitting (in my opinion, though, if
    i can have a
    > copy of the submission sent to the submitter, there's no
    reason for
    > this). But if anyone knows how to do this, please let me
    know.
    >
    > - Finally, the client wants to know if each submission
    can have a
    > unique
    > tracking number assigned to it.
    >
    > Thank you all. Any feedback is appreciated.
    >
    > Richard
    >
    >

  • Can't get PHP's mail() function to work on local Apache install

    I'm using Leopard and installed all available updates. I've done a clean install of Leopard, so no Tiger upgrade.
    I've installed the latest stable versions of Apache, PHP and MySql through MacPorts/command line in Leopard. So far so good, everything works except for PHP's mail() function.
    Does anyone know how to get PHP's mail() function to work on my localhost? Searching the web through Google taught me it's impossible to get it to work under Leopard but I find that hard to believe. Can anyone help me out?

    Any help appreciated.

  • PHP's mail() function doesn't work as under Lion Server

    Since I've upgrades to OS X Server (10.8) my web-based contact form became essentially useless since the PHP function mail() didn't work anymore. There was a lot of traffic during those days and I bet I lost a lot of messages because of it. Does anyone have a remedy or a working example PHP script that works in OS X Server (10.8)?

    From my understanding, trying to save apple server specific attributes on Active Directory users in the WGM will not work unless the AD schema has been extended to include these attributes.
    What you can do in leopard server is to export the list of AD users in WGM and then import them into open directory in WGM.
    From my testing the open directory will automatically authenticate with AD for those imported users. You can save Apple server attributes on those imported users.
    Message was edited by: Kwong Kian Tew

  • Include PHP and/or JAVA code in any BC site.

    I am thinking about including some PHP and/or JAVA code into my BC site and I was wondering if I am allowed to do this. Just Curious. Thanks.

    That's a shame, because I was thinking about implementing a business search api for my real estate website that was created using business catalyst that allows the collection of all real estate agents in Australia by searching and collecting their information from the Yellow Pages and White Pages directories, and include these information in a database that allows users to search for the real estate agent they want and comment on that agent. This can only be done by integrating some PHP or JAVA code into my BC website.
    So that means that the only way that I can do this is to create a web app that allows users to search for the real estate agent they want to see and comment on that agent, just by entering real estate agents' information into the web app's database and using various BC modules and plugins. Are there other easier ways to do this? Thanks.

  • PHP and MySQL Connection problem

    I am trying to make a PHP MySQL on a remote server connection in Dreamwesaver CS3.
    When I enter the information (host, user, password, etc.) and hit TEST, I get the following error message.
    "Access Denied. The file may not exist, or there could be a permission problem. Make sure you have proper authorization on the server and the server is properly configured."
    I know the user, password, etc. work, as I can access the MySQL database with other software.
    I checked with my host and they say there are no permission problems on their end.
    I have checked the settings on the Test Server page in Site Setup and everything looks correct and works there.
    I have not seen this particular problem described in other forum postings (although there are a LOT of postings on this topic!).
    Any help would be appreciated.

    I thought my testing server was the remote server and is always on as far as I know. I don't know how to turn it on or off.
    Is there some other testing server that I should be aware of?
    Frank
    Date: Wed, 3 Jun 2009 15:43:02 -0600
    From: [email protected]
    To: [email protected]
    Subject: PHP and MySQL Connection problem
    I know you are using remote, but is your testing server on? if not turn that on and see if that does it. it just happened to me working on remote server and could not get mysql conn to work, until I turn on my testing (developer server), then I was able to connect to mysql and the tables that I created in phpmyadmin remotly was downloaded.
    >

  • How do I add an already built Shopping Cart  (PHP and MYSQL) application to a page in a Muse site?

    How do I add an already built Shopping Cart  (PHP and MYSQL) (Cartweaver 4) application to a page in a Muse site? Do I have to export the Muse site as Html to dreamweaver and them use the extension to bring the shooping cart in or can I do it directly in Muse?
    Message was edited by: mgv2048

    We have experimented with doing this with some good success. We have been working on adding Cartweaver to a Facebook page by essentially adding a Cartweaver store to Facebook in an iframe.  The "store" would be pages with just your basic product display, cart, and checkout functionality, with none of the "window dressing" - just use CSS to match the color and general look of the design it's being added to.
    The one problem with this for Facebook is when it comes time to check out toy have to leave Facebook and go to your server where an SSL is in place.  Fortunately in this situation this would not be the case, you can have an SSL installed to the root of your site and you'll be okay.
    This is an interesting project.  Give this a try and let me know how it goes and if you run into any snags, please make a post on the Cartweaver forums: http://forums.cartweaver.com - I'm really confident that this can work, and not only work, but work well.
    Looking forward to hearing how this goes, and being of what help we can.
    Lawrence Cramer - *Adobe Community Professional*
    http://www.Cartweaver.com
    PHP & ColdFusion Shopping Cart for Adobe Dreamweaver
    Stay updated:
    http://www.facebook.com/cartweaver
    http://www.twitter.com/cartweaver
    http://blog.cartweaver.com

  • Converting report to PDF and mailing

    Hi every one,
    I've gone through various threads and i'm aware of the Functional module's used to
    convert the report to pdf and mail it back.Like CONVERT_OTFSPOOLJOB_2_PDF, CONVERT_OTF_2_PDF and for mailing we have SEND_NEW_DOCUMENT_ATT_SEND_API1.
    I've worked with this but my problem is i'm not able to convet the report output to pdf.When i'm doing this i'm getting the output of my functional module converted to pdf like the number of header and item records available for the given data in the selection screen.
    Since all the threads i've gone through is converting the single internal table which has the output to pdf.
    But i've got the REUSE_ALV_HIERSQL_LIST_DISPLAY, hierarchial report which as known has got two internal tables.How to the same to this kind of report....More over is it possible to convert report to pdf in online without transfering it to spool and getting the spool id to convert it to pdf.........
    Any help or suggestions will surely be rewarded......
    Thanks in Advance.....

    Here is the complete code for you;
    It Converts spool request into PDF document and emails it.
    <b>http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm</b>
    Regards,
    Vishal

  • Getting stylesheets to work in header.php and files associated with it

    Let's say I created a header.php file in my includes folder.  And I include it in my index.php file in the site root directory.
    Then in the header.php file, I have a link to the style sheet. 
    The issue I've always found is that you can't get the header.php file to apply the stylesheet.
    I can get it to work using global links, however I don't want to do that as I'll have to undo them before I upload the site.  (And I forget....)
    So anyways, I came up with this code today in an attempt to overcome this.  Here is my header file so far:
    "; } else           echo ""; ?>  
    So here is what it is doing:
    1. It is creating a variable called $directory which is equal to the current directory.
    2. Then it is creating another variable called $currentFolder which is equal to whether or not the variable $directory contains the word "includes".
    3. Then it says if $currentFolder is NOT false then it has the location of the stylesheet in relation to the header.php file.
    4. Else - if it IS false then the stylesheet is located in a location in relation to files in my root directory.
    This works perfectly fine....in Live view.  Both the header.php and index.php will format the header in live view.  Neither though will format it in Design view.  Which sucks cause I was pretty happy that I came up with this code on my own.
    The reason it isn't working in Design View - I realize now - is because Dreamweaver won't process that script in Design View. 
    Does anyone know of a way to get this script to run in Design View?  Or maybe some suggestions on editing this code to get it to work in Design View?
    Thanks!

    >The issue I've always found is that you can't get the header.php file to apply the stylesheet.
    Right. That's because, and it seems you understand this already, the css file relative location is different from the point of view of the header file, and the parent file. Since the header file is included in the parent at the server, the client then sees the css file in the wrong location.
    The solution is to use Design time style sheets. This will apply the css to the page only in design time - it won't actually insert the css file into the code. So, insert the css reference into the header file from the point of view of the parent - index.html. Then add a design time style sheet. That should work.

  • App store and mail won't open. Help!

    Just cleaned my iMac with Clean My Mac and now my app store and mail wont open. Please help.

    Delete the app from the machine, boot into recovery mode, and reinstall the OS.

  • App Store and mail don't work in mavericks on a Mac Pro mid 10

    App Store and mail don't work in mavericks on a Mac Pro mid 10
    During the day more and more functions of my MacPro (mid10) are down. Icons disappear, mail pop out every time, app store doesn't even come up, wifi connection to other devices like ipad and macbook air fails.
    Any suggestion to come over this terrible upgrade?

    App Store and mail don't work in mavericks on a Mac Pro mid 10
    During the day more and more functions of my MacPro (mid10) are down. Icons disappear, mail pop out every time, app store doesn't even come up, wifi connection to other devices like ipad and macbook air fails.
    Any suggestion to come over this terrible upgrade?

  • App store and Mail app are crashing in my mac air 10.9.5

    All my apps are crashing and i am not able to open any of them . App store for Software update and Mail app, Photos app are all crashing. I have OS X 10.9.5 in my system. I removed Parallels trail version and also Clean My Mac app, Still i have the issue,Please help me to resolve the issue,

    "CleanMyMac" purports to "clean up" "junk" files. What it really does is to corrupt the operating system and many applications.   
    The first thing you need to do is remove that software according to the developer's instructions. Never install it, or anything like it, again. Then see below.
    If you don't already have a current backup, back up all data, then reinstall the OS.* You don't need to erase the startup volume, and you won't need the backup unless something goes wrong. If the system was upgraded from an older version of OS X, you may need the Apple ID and password you used.
    If you use FileVault 2, then before running the Installer you must launch Disk Utility and select the icon of the FileVault startup volume ("Macintosh HD," unless you gave it a different name.) It will be nested below another icon with the same name. Click the Unlock button in the toolbar and enter your login password when prompted. Then quit Disk Utility to be returned to the main Recovery screen.
    There are ways to back up a computer that isn't fully functional. Ask if you need guidance.
    If you installed the Java runtime distributed by Apple and still need it, you'll have to reinstall it. The same goes for Xcode. All other data will be preserved.
    *The linked support article refers to OS X 10.9 ("Mavericks"), but the procedure is the same for OS X 10.7 ("Lion") and later.

  • Help please-"Application Not Responding" for Safari and Mail

    I read in one discussion that if Safari is slow, you can go to Font Book and select the fonts with a bullet to get rid of duplicate fonts. I did that, and then decided to disable some japanese fonts I don't use.
    Now Safari and Mail don't work. Mail won't open at all, and Safari launches but doesn't load and I get the spinning wheel.
    I used Disk Utility to fix permissions, and that didn't solve the problem, and now my Disk Utility also says "Application Not Responding".
    I also went back to Font Book and enabled all the fonts I disabled. Still nothing.
    ( I can use Netscape-so it's only Mac applications I guess)
    Any help is very much appreciated.
    Thanks!
    powerpc g4   Mac OS X (10.3.2)  

    I read in one discussion that if Safari is slow, you
    can go to Font Book and select the fonts with a
    bullet to get rid of duplicate fonts. I did that, and
    then decided to disable some japanese fonts I don't
    use.
    Now Safari and Mail don't work. Mail won't open at
    all, and Safari launches but doesn't load and I get
    the spinning wheel.
    I used Disk Utility to fix permissions, and that
    didn't solve the problem, and now my Disk Utility
    also says "Application Not Responding".
    I also went back to Font Book and enabled all the
    fonts I disabled. Still nothing.
    ( I can use Netscape-so it's only Mac applications I
    guess)
    Any help is very much appreciated.
    Thanks!
    powerpc g4 Mac
    OS X (10.3.2)
    Wow- i fixed it! I remembered that when I was in Font Book originally, there were some fonts disabled, and I enabled them.
    I couldn't remember EXACTLY which ones, but I disabled some I thought were the ones, and VOILA!
    Mail works, Safari works...what a relief!
    And it only took me HOURS...oh well.
    If this might help anyone, here are the fonts I disabled again-
    BeteNoirA Regular
    BoyzRGross
    Chrome Yellow
    Coventry Garden
    FancyPants
    HardlyWorthit
    PleasinglyPlump
    RaggMoppRegular
    Anyone know if I should throw these fonts away? maybe a stupid question, but I'm not very good at this stuff and hesitate to change anything.
    powerpc g4 Mac OS X (10.3.2)

  • Software update and now Safari and Mail open and then close immediately

    We installed the latest 8-1 software updates on our G4 and Cube.
    Now Safari and Mail open and then immediately quit on the Cube - but no peroblems are experienced on the G4.
    Do I need to reinstall Tiger and start over?

    A couple of things to try before taking those drastic measures.
    1. Repair permissions, restart.
    2. Boot with the install disk, launch Disk Utility, and verify/repair the disk.
    3. Boot into safe mode and see if it works there.
    4. Reinstall the 10.4.7 COMBO update, restart, repair permissions, and restart.
    If those don't work, consider Archive & Install rather than an Erase & Install. See http://www.apple.com/support/tiger/install/ for details.

  • Safari and mail will not load but i am connected to internet and can download form itunes and other sourses is that HD failure?

    Safari and mail will not load but i am connected to internet and can download form itunes and other sourses is that HD failure?  any suggestions ?  verify disk says its OK

    iOS 4: Updating your device to iOS 5 or later - Support - Apple
    iOS: Unable to update or restore - Support - Apple
    iTunes for Windows: iTunes Store connection troubleshooting
    See if any of these three may help.

Maybe you are looking for

  • QuickAddress(UK) in Forms6

    I am looking at using QuickAddress to automatically populate address fields in Forms 6 client server. (Windows Client, Unix Server). Does anyone know how this works.

  • Dont want to download webstart application onto desktop

    Hi all, I dont want my webstart application to be downloaded on desktop or you can say i dont want shortcut of this application on my machine. I want to restrict opening of this application from shortcut. I want it can only be opened using explorer.

  • Upgraded to v7 can't burn playlists longer than 50ish MBs to 80MB disc - Y?

    Upgraded from v6 to v7.0.2 iTunes today. Tried to burn a playlist consisting of 18songs 1hour 80.1MB to a blank CD but couldn't? When previously I did (earlier today) when I still had iTunes v6? Managed to successfully burn a playlist (in v7) of 11 s

  • Can someone explain to me how to correct this problem??

    I first want to thank anyone who reads my post and responds to it.. These boards have taught me so much over the years... My G4 450 or what I call my plow horse has recently started to run slowly especially while i tried to surf the web.. I decided t

  • Cannot import REX files in Logic 7.2

    Since i bough a new Intel Mac Mini and have upgraded to Logic Pro 7.2, I can no longer import REX / Recycle files into my Logic song. I get the message "What kind of file is this?" Seems to be clearly a bug. Anyone have any info on this? MacMini Core