sending email with php
am 15.01.2008 03:14:37 von B
Hi,
Im new to php (as of this weekend)
I have an app setup which sends an email. I'm using php and mysql on
Ubuntu.
I'm a little confused how to setup the smtp mail servers in the
php.ini file (this is where I set it up right?)
Im sure I have the actual php code correct in my page, and it is the
mail server settings thats creating the problems.
Thanks for your time
:)
Re: sending email with php
am 15.01.2008 05:58:55 von Manuel Lemos
Hello,
on 01/15/2008 12:14 AM B said the following:
> Hi,
> Im new to php (as of this weekend)
> I have an app setup which sends an email. I'm using php and mysql on
> Ubuntu.
> I'm a little confused how to setup the smtp mail servers in the
> php.ini file (this is where I set it up right?)
>
> Im sure I have the actual php code correct in my page, and it is the
> mail server settings thats creating the problems.
It depends. You only need to setup SMTP servers under Windows. Under
Linux/Unix messages are not relayed on SMTP servers.
Are you having difficulties to have your messages sent with the mail()
function? What operating system are you using in your Web server machine?
--
Regards,
Manuel Lemos
PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Re: sending email with php
am 15.01.2008 07:15:37 von Daniel Ennis
B wrote:
> Hi,
> Im new to php (as of this weekend)
> I have an app setup which sends an email. I'm using php and mysql on
> Ubuntu.
> I'm a little confused how to setup the smtp mail servers in the
> php.ini file (this is where I set it up right?)
>
> Im sure I have the actual php code correct in my page, and it is the
> mail server settings thats creating the problems.
>
> Thanks for your time
> :)
You should just be able to use sendmail with the mail(); command.
Try this
mail('who@to.send.to','Testing Email','Hello!','From: your@email.com');
?>
this is enough for a basic sending of mail, and can be used for more
complex emails too using the 4th parameter of headers.
--
Daniel Ennis
faNetworks.net - Quality Web Hosting and Ventrilo Services
System Administrator / Web Developer
PHP Developer for 6 years
daniel@fanetworks.net
Re: sending email with php
am 15.01.2008 14:40:42 von Toby A Inkster
B wrote:
> I'm a little confused how to setup the smtp mail servers in the php.ini
> file (this is where I set it up right?)
On non-Windows servers, PHP does not send mail through SMTP -- it uses the
sendmail binary.
This means you need to install the "sendmail" package, or any other mail
transfer agent that is sendmail-compatible. Indeed, sendmail is pretty
hard to configure and can very easily create big security headaches for
you, so I'd recommend use a compatible MTA instead.
I use Postfix, but that's because I need to receive mail too. If you are
sure that this server only needs to send mail, then Nullmailer might be a
better choice.
http://www.postfix.org/
http://untroubled.org/nullmailer/
I don't use Ubuntu, but I'd be willing to bet that it includes a Postfix
package, and probably a Nullmailer one too.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 16 days, 47 min.]
GPS & Cameras
http://tobyinkster.co.uk/blog/2008/01/14/gps-cameras/