LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-29-2009, 11:41 AM   #16
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102

Ok try this and see if you get any results.
Code:
<?php

$Name = " "; //senders name
$mail_from = "email@adress.com"; //senders e-mail adress
$mail_to = "somebody@nobody.com"; //recipient
$mail_body = "Email Message Here"; //mail body
$subject = "Subject for reviever"; //subject
$header = "From: ". $Name . " <" . $mail_from . ">\r\n"; //optional headerfields

ini_set('sendmail_from', 'me@domain.com'); // Put this in as a last resort. 

mail($mail_to, $subject, $mail_body, $header); //mail command :)
?>
 
Old 01-29-2009, 12:22 PM   #17
leicaphotos
Member
 
Registered: Oct 2008
Posts: 68

Original Poster
Rep: Reputation: 15
here's what I got:

root@pcbsd# php -r mailtest.php
PHP Warning: Module 'mysql' already loaded in Unknown on line 0
PHP Warning: Module 'zlib' already loaded in Unknown on line 0
PHP Parse error: syntax error, unexpected $end in Command line code on line 1
You have new mail.
root@pcbsd#
 
Old 01-29-2009, 12:37 PM   #18
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
so I looks like it sent mail. also try with just php mailtest.php and see if you get the same error. Looks like you may have a problem in your php.ini file. How did you install apache, mysql, and php?
 
Old 01-29-2009, 01:27 PM   #19
leicaphotos
Member
 
Registered: Oct 2008
Posts: 68

Original Poster
Rep: Reputation: 15
i did my install using the pcbsd insrtall process -- i'm befuddled as to where something's not working as all other php functions work correctly- - I don't mind reinstalls... just need to have an inkling which way to go


but this is helping me learn more about the os- -- my experience has been limited to admin functions for php websites -- now it's moving towards sysadmin
 
Old 01-29-2009, 02:47 PM   #20
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
I say something might be wrong in your php.ini becuase if you do the following
Code:
php mailtest.php
it should not load mysql as we did not use the function but it talks about loading the php mysql function and also throws and error in regards to an $end in your command line.
 
Old 01-29-2009, 10:17 PM   #21
popowich
Member
 
Registered: Nov 2004
Location: Rochester, New York
Distribution: RHEL7
Posts: 53

Rep: Reputation: 15
Hello,

Is this even a php problem? You have a mail log for the mail being created and an attempt to send so I'd think we can look elsewhere. What happens if you login to the server and do a "telnet 207.247.2.212 25" ? That's the IP for the MX record for cookbooks.com

Quote:
;; ANSWER SECTION:
cookbooks.com. 86400 IN MX 10 www.cookbooks.com.

;; ADDITIONAL SECTION:
www.cookbooks.com. 86400 IN A 207.247.2.212
Can you send any mail from the server?

If that doesn't work do you need to have the server configured to relay out though your ISP's smtp relay or have them allow outbound port 25 in their firewall?

Can you telnet gmail-smtp-in.l.google.com 25 ?

-Raymond
 
Old 01-30-2009, 08:45 AM   #22
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
The reason that I say there COULD be a problem with his php is because the command line is throwing other errors when executing the script. IE problems with mysql. Now while the op looks like he got the mail, I am not satisfied with saying ok problem is fixed even though you are getting command line errors.
 
Old 01-30-2009, 08:49 AM   #23
leicaphotos
Member
 
Registered: Oct 2008
Posts: 68

Original Poster
Rep: Reputation: 15
ok =-- it may very well be a dns issue as well --- I want to see what I can do to fix the php error --- not sure where to start with tracking it down
 
Old 01-30-2009, 08:50 AM   #24
leicaphotos
Member
 
Registered: Oct 2008
Posts: 68

Original Poster
Rep: Reputation: 15
still not receiving mail sent outside the box either - most likely that's dns

what should my mx record read? mail.domain.com or just the ip
 
Old 01-30-2009, 08:57 AM   #25
leicaphotos
Member
 
Registered: Oct 2008
Posts: 68

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by popowich View Post
Hello,

Is this even a php problem? You have a mail log for the mail being created and an attempt to send so I'd think we can look elsewhere. What happens if you login to the server and do a "telnet 207.247.2.212 25" ? That's the IP for the MX record for cookbooks.com



Can you send any mail from the server?

If that doesn't work do you need to have the server configured to relay out though your ISP's smtp relay or have them allow outbound port 25 in their firewall?

Can you telnet gmail-smtp-in.l.google.com 25 ?

-Raymond
the domain is cookbooksonline.com - wee also own cookbooks.com which this domain will replace - the mail server for cookbooks.com will remain windows - but our emails originate from cookbooks.com - all kinds of windows stuff on that mail server - they have no desire to migrate that part
 
Old 01-31-2009, 08:26 AM   #26
3rods
Member
 
Registered: Mar 2008
Posts: 70

Rep: Reputation: 16
Quote:
Originally Posted by leicaphotos View Post
i have a simple php mail script and am seeing this from command line:

php mailtest.php
PHP Warning: Module 'mysql' already loaded in Unknown on line 0
PHP Warning: Module 'zlib' already loaded in Unknown on line 0
1root@pcbsd# php -r mailtest.php
PHP Warning: Module 'mysql' already loaded in Unknown on line 0
PHP Warning: Module 'zlib' already loaded in Unknown on line 0
PHP Parse error: syntax error, unexpected $end in Command line code on line 1


odd odd am thoroughly confused now

You're getting this error because you're trying to load the modules twice (or more) in your php.ini file. Look in the php.ini for duplicates. The "unexpected $end" sounds like there is an extra semi-colon tossed in somewhere and/or something's not being parsed properly.

However, those (module) errors shouldn't hinder your ability to send mail. I'm not sure where you are on the IT food chain, but there is a good chance that the admin of that network is using a (good) firewall or PIX and has setup a smart host for out going mail.

For instance, if you're not in the DMZ, then you could be pinging a server outside, and *packets get there*, but rebound packets are dropped by the firewall. All you know is you can't ping the host or any host. These are the strange things that happen when you don't have the 30,000 foot view of the network.

If you can't do this, and get some form of response, you can't send mail:

Code:
telnet smtp.gmail.com 25

Your MX record has no bearing on your ability to send mail *out*; it's only there so people know where to send mail back.
 
Old 02-02-2009, 08:15 AM   #27
leicaphotos
Member
 
Registered: Oct 2008
Posts: 68

Original Poster
Rep: Reputation: 15
from my php.ini could this be what's hosing everything?

I'm trying to quickly get this and a few other issues under wraps

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
 
Old 02-04-2009, 08:06 AM   #28
leicaphotos
Member
 
Registered: Oct 2008
Posts: 68

Original Poster
Rep: Reputation: 15
still having issues --- maybe I need to reinstall from ports -- but not sure where to go from here
 
Old 02-25-2009, 06:52 AM   #29
leicaphotos
Member
 
Registered: Oct 2008
Posts: 68

Original Poster
Rep: Reputation: 15
ok, it has been estimated that the problem might be fixed by reistalling php/mysql ---

using ports/databases/php5-mysql
make reinstall I get the following:
Quote:
root@pcbsd# make all install clean FORCE_PKG_REGISTER
===> Installing for php5-mysql-5.2.6_2
===> php5-mysql-5.2.6_2 depends on file: /usr/local/include/php/main/php.h - found
===> php5-mysql-5.2.6_2 depends on shared library: mysqlclient.16 - found
===> Generating temporary packing list
===> Checking if databases/php5-mysql already installed
===> php5-mysql-5.2.6_2 is already installed
You may wish to ``make deinstall'' and install this port again
by ``make reinstall'' to upgrade it properly.
If you really wish to overwrite the old port of databases/php5-mysql
without deleting it first, set the variable "FORCE_PKG_REGISTER"
in your environment or the "make install" command line.
*** Error code 1
The question from here is how do I reinstall without losing my gig database in mysql
 
Old 02-25-2009, 07:46 AM   #30
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
after re reading a couple of post back, I am confused as to why you are using the win32 section in your php when you need to comment those out

[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25
// Comment both of those and use the sendmail_path

; For Win32 only.
;sendmail_from = me@example.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = sendmail -t -i

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Mail Not Working RAH104 Linux - Server 3 07-24-2008 09:49 AM
php mail() not working but mailx works twlilinux Linux - Server 6 07-03-2008 09:16 PM
PHP mail() function not working with Exim Madone_SL_5.5 Programming 6 12-03-2006 09:05 PM
php mail() not working sajith Programming 2 11-30-2006 10:54 AM
php mail() function not working as it should on my box juancha Linux - Newbie 14 02-16-2006 12:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration