DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-05-23 12:03:26

kreuters
Member
Registered: 2007-04-13
Posts: 13

sending mail from php

hey

i am having a few problems sending mail from php, wondered if anyone could assist? i am using fun plug 0.5, with mysql enabled php from fonz. i have also installed optware esmtp, and can send mail from the command line successfully.

now then, i edit php.ini to include:

sendmail_from = toaster@blah.com
sendmail_path = /opt/bin/esmtp -C /opt/etc/esmtprc

i restart lighttpd, then try a very simple php script which calls the mail() function, but it does not succeed. when i check the php error log, there is no message regarding mail.

can anyone help?

Offline

 

#2 2008-05-23 12:10:46

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: sending mail from php

kreuters wrote:

mysql enabled php from fonz

There is no "mysql enabled php" from fonz.

PS: After a quick look at http://de2.php.net/manual/en/mail.configuration.php I think that your "sendmail_path" option is wrong. All text options shown on php.net are quoted.

Offline

 

#3 2008-05-23 13:48:52

kreuters
Member
Registered: 2007-04-13
Posts: 13

Re: sending mail from php

you are quite right, the minimal stylings of this webpage (http://81.216.140.39/dns-323/mysql_and_php/) made me think it was yours.

that seems to have done the trick fonz, much obliged. any closer to integrating pkgsrc into the fun plug setup? much impressed with the work you have done so far, is slick.

Offline

 

#4 2008-05-23 14:28:52

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: sending mail from php

kreuters wrote:

that seems to have done the trick fonz, much obliged.

noob.

kreuters wrote:

any closer to integrating pkgsrc into the fun plug setup? much impressed with the work you have done so far, is slick.

it seems to work fine on my dns323, but in a eglibc environment. I haven't got pkgsrc work well with uclibc, yet.

Offline

 

#5 2008-07-17 00:29:35

NickInSanDiego
Member
Registered: 2007-06-28
Posts: 8

Re: sending mail from php

I'm trying to use the mail() function from a PHP script as well. I only have the basic 0.5 fun_plug PHP package installed. I tried to do some configuring of the php.ini file but without any luck. Am I missing a mail package? Can someone offer some suggestion?

Last edited by NickInSanDiego (2008-07-17 00:29:56)

Offline

 

#6 2008-07-17 01:14:18

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: sending mail from php

NickInSanDiego wrote:

I'm trying to use the mail() function from a PHP script as well. I only have the basic 0.5 fun_plug PHP package installed. I tried to do some configuring of the php.ini file but without any luck. Am I missing a mail package? Can someone offer some suggestion?

Recent busybox packages have sendmail support. If you don't have /ffp/bin/sendmail, upgrade to the latest busybox package, and create the link:

Code:

funpkg -u busybox-1.11.1-1.tgz
ln -s busybox /ffp/bin/sendmail

Config should look sth like this:

Code:

sendmail_path = /ffp/bin/sendmail

Run 'sendmail -h' to see the available options.

Offline

 

#7 2008-07-17 01:35:16

NickInSanDiego
Member
Registered: 2007-06-28
Posts: 8

Re: sending mail from php

My config should be alright then. Must have something to do with my ISP block mail relays and port 25. Is there anyway to forward my request to my cox.net smtp server instead?

Last edited by NickInSanDiego (2008-07-17 01:35:33)

Offline

 

#8 2008-07-18 23:18:05

peter_f
New member
Registered: 2008-07-18
Posts: 1

Re: sending mail from php

On my ch3snas sendmail works fine, but with php it doesn't.
But you can use PEAR mail (extension for php, shoult be preinstalled with php), you can easily send html mails, using attachments.

Offline

 

#9 2008-07-19 07:17:00

NickInSanDiego
Member
Registered: 2007-06-28
Posts: 8

Re: sending mail from php

Cool, PEAR comes preinstalled with PHP. I'm running into a little bit of a problem though. When I issue the command 'pear install Mail-1.1.14.tgz' to install the Mail package, I'm getting the following error "The extention 'zlib' couldn't be found. Please make sure your version of PHP was built with 'zlib' support." Is zlib an option I can enable easily?

Offline

 

#10 2008-07-19 14:30:58

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: sending mail from php

NickInSanDiego wrote:

Is zlib an option I can enable easily?

Would have been a matter of seconds if you had used the forum search:
http://dns323.kood.org/forum/p16427-200 … tml#p16427

Offline

 

#11 2008-07-19 17:13:13

NickInSanDiego
Member
Registered: 2007-06-28
Posts: 8

Re: sending mail from php

fonz wrote:

NickInSanDiego wrote:

Is zlib an option I can enable easily?

Would have been a matter of seconds if you had used the forum search:
http://dns323.kood.org/forum/p16427-200 … tml#p16427

Thanks. I tried searching for pear but only came back with 4 results. Should have tried zlib.

Offline

 

#12 2009-01-13 21:18:09

jrbilodeau
Member
Registered: 2007-11-26
Posts: 47

Re: sending mail from php

just wondering if someone could help me out. I'm trying to get he php mail() function working for a small website i have in place. so far this is what i've done.
funpkg -i openssl-0.9.8h-1.tgz
funpkg -i uclibc-0.9.29-7.tgz
funpkg -i libesmtp-1.0.4-1.tgz
funpkg -i esmtp-0.6.0-2.tgz

from here i created a file in /ffp/etc/esmtprc with the following contents.

identity username@gmail.com
hostname smtp.gmail.com:587
username "username@gmail.com"
password "password"
starttls required

next i did the following

mkdir ~/.authenticate
chmod 0700 ~/.authenticate
wget https://www.verisign.com/support/thawte-roots.zip  ----this didn't work so i downloaded it to Volume_1 and moved it to the ~/.authenticate dir
unzip -p thawte-roots.zip 'Thawte Server Roots/ThawtePremiumServerCA_b64.txt' > ~/.authenticate/ca.pem
chmod 0600 ~/.authenticate/ca.pem

from there i modified the php.ini file
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = "example@gmail.com"

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = "/ffp/bin/esmtp -C /ffp/etc/esmtprc"

then i restarted lighttpd.


when i use this php code it says it failed

<?php
$to = "myaccount@gmail.com";
$subject = "Test";
$body = "Hi,\n\nThank you for registering your account.";

if (mail($to, $subject, $body))
{
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>

could anyone tell me if im doing something wrong, or if there is a better way to get this working.

thanks

Offline

 

#13 2009-01-14 22:13:00

jrbilodeau
Member
Registered: 2007-11-26
Posts: 47

Re: sending mail from php

Anyone have suggestions how i can send email with php from the DNS323, with either a gmail, hotmail, or cogeco account (thats my isp)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB