|
|
| Welcome to the Mac Forums forums. Please read the FAQ if you have questions. Register to participate. |
|
|||||||
| TouchArcade.com - iPhone Game Reviews and News |
![]() |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
macrumors member
|
Sending mail from the server
I cannot find any scripts online that work with my web server.
The web server has a built in utility for sending mail but it forces you to use their ugly contact forum, and the perl file is a bloated mess that none of us can begin to edit. We don't care about anti-spam or anything. We already have the contact forum set up. We just need a simple 10 to 20 line perl file that can send an email to our webmaster. After looking for scripts all day and night and testing around 20 or so, this still is not working. I've tried everything. There must be a mail server set up because the built in one sends the mail, but we need something simpler. All the websites are saying not to use sendmail because it's bloated, and are saying to use this script instead of this one, etc. but we're not sure which to use or even if it is set up. Thanks for any help. |
|
|
|
| Fromethius |
| View Public Profile |
| Find More Posts by Fromethius |
|
|
#2 |
|
macrumors 68000
Join Date: Jul 2006
|
If you have PHP set up on your server the mail function is pretty straight forward.
Code:
<?php
mail('you@yourdomain.com','subject', $_POST['message']);
?>
__________________
TimeTable: The Freelancer's Tool |
|
|
|
|
|
#3 |
|
Thread Starter
macrumors member
|
PHP is not set up, I believe. We need to use perl scripts and the such.
|
|
|
|
| Fromethius |
| View Public Profile |
| Find More Posts by Fromethius |
|
|
#4 |
|
macrumors 68000
Join Date: Jul 2006
|
I doubt php is not setup unless you specifically know it is turned off for some reason, (or consequently not installed)... but I cant really help you with perl as it is pretty much gone the way of the dodo...
however a quick google search turned this up, http://www.cyberciti.biz/faq/sending...l-mail-script/ which looks pretty straight forward.
__________________
TimeTable: The Freelancer's Tool |
|
|
|
|
|
#5 |
|
macrumors 601
Join Date: Aug 2005
Location: Dayton, OH
|
I wouldn't say Perl has gone the way of the dodo. Myself and a number of my co-workers still use it.
Anyways, have you tried the obvious thing and ask your web host what they allow? That would be the simple approach. |
|
|
|
|
|
#6 |
|
Thread Starter
macrumors member
|
Yes, we're using networksolutions as a host and (domain provider?).
They don't specify (or at least I couldn't find) whether or not they support php and upon creating a phpinfo() file to test it, it doesn't display it, which leads me to believe they do not support it. I used the same phpinfo file for my web server on my macintosh and it showed right up. Perhaps we have a lower service package? Maybe it was never configured? Maybe they just don't support it? I don't know, but I really want to use php because it seems so much simpler than perl (which I could not get to work at all yet!, including your article) and I actually know php. |
|
|
|
| Fromethius |
| View Public Profile |
| Find More Posts by Fromethius |
|
|
#7 |
|
macrumors 601
Join Date: Aug 2005
Location: Dayton, OH
|
|
|
|
|
|
|
#8 |
|
macrumors 601
Join Date: Jan 2006
Location: Redondo Beach, California
|
On any UNIX-like system you can send mail with just one line. See the "mail" man page for details. But basically it goes like this
Code:
mail -s "example subject line" someone@myplace.com < filename.txt Read the mail man page. |
|
|
|
|
|
#9 |
|
Thread Starter
macrumors member
|
Figured it out.
The problem was due to our domain still being on a Windows box. I had to call customer support and have all the emails and the domains moved to a Unix box. Now PHP is working properly as defined in the phpinfo file. However, when I use the mail function, the mail is still not sent to me. I called customer service again and they didn't know. They said I might have to find my own sendmail executable and reference it, but shouldn't they have included it? Either way, I'm one step closer but still no e-mail. |
|
|
|
| Fromethius |
| View Public Profile |
| Find More Posts by Fromethius |
|
|
#10 |
|
macrumors 65816
Join Date: Dec 2007
Location: Falls Church, Va.
|
YES, they should!!!!
On that Unix server, there are traditionally one of two MTA's, either sendmail or exim. Sendmail is the most common, Exim is arguably a little more secure depending on who you ask (I agree). Go into the Unix shell and simply type in "sendmail -bp" or "exim -bpa" and see if either one exists. Those commands actually dump the mail queue, demonstrating if they're working properly. If you can't find the MTA that way, this means the path environment isn't setup properly (probably) to run daemons without specifying path so perform one more simple search of each to double check: "locate sendmail | grep bin" or "locate exim | grep bin" That searches for each and includes in the output any binary paths meaning that's where the deamon lives. Traditionally for each it's in /usr/sbin but this is how you find out for sure. Once you have the proper path to the proper MTA (i.e. "/usr/sbin/sendmail") then run your phpinfo() page again and see what's set for the "Configuration File (php.ini) Path" variable. That''s the config file for PHP showing you the full path (usually /etc/php.ini) to the php.ini file. Edit the php.ini file and set the variable "sendmail_path" accordingly: (example path, use your own) If MTA is sendmail: /usr/sbin/sendmail -t -i If MTA is exim: /usr/sbin/sendmail -t Note: Exim has a sendmail alias and doesn't need the -i parameter Also set smtp_port=25 (the most common SMTP port) Save php.ini Restart the web server, and that should remedy things. If not, contact tech support and tell them the MTA isn't working or PHP can't access it and ask them to debug the above settings. If they tell you they don't have an MTA or you can't access it, drop them and find another host!!!!! heh -jim
__________________
Jim, Sr. Web Developer If you ever want to know who you true friends are, ask them to either paint or move furniture. |
|
|
|
|
|
#11 |
|
Thread Starter
macrumors member
|
Thanks, after creating a php.ini file in the cgi-bin directory with these lines:
sendmail_path = /usr/sbin/sendmail -t -i smtp_port = 25 It now works. |
|
|
|
| Fromethius |
| View Public Profile |
| Find More Posts by Fromethius |
|
|
#12 |
|
macrumors 65816
Join Date: Dec 2007
Location: Falls Church, Va.
|
Excellent, enjoy!
__________________
Jim, Sr. Web Developer If you ever want to know who you true friends are, ask them to either paint or move furniture. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|