Re: Email from php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2010-05-19 at 16:57 +0530, Ferdi wrote: 
> Hi List,
> 
> I have met with little success sending mail from PHP. I have used mainly the
> mail() function but have also tried imap_mail() which the documentation says
> is just a wrapper around mail().
> 
> Here is my understanding of the situation:
> On Windows (WampServer 2.0i ) I manage to send email after setting SMTP =
> smtp.someserver.com. I guess this works because the server I use relays all
> mail received; it does not check if the user has been registered or not. It
> obviously does not bother about the password.
> 
> On Linux (Centos 5.XX, XAMPP 1.7.2), the above function [mail()] does not
> work. On Linux, what I have understood, is that the smtp server settings in
> php.ini do not matter. The sendmail / mail (something like that) utility is
> called which sends the mail. I have put in the correct sendmail_path setting
> in php.ini, but, I guess this utility is not configured since I don't
> receive the mail and running the code does not throw up errors or warnings.
> 
> What I need to achieve is the ability to send attachments in an email from
> PHP. I would like one of the following options (in order of preference):
> 
> 1. Create an email account (specifically Google Apps Mail) and send email as
> that user. This will not be trivial. I will need to get a fix on
> authenticating, logging in etc.
> OR
> 2. Send mail using an SMTP server. Could you also point me to links showing
> installation / setting up of a SMTP server on Linux? The XAMPP docs say the
> Mercury mailserver is included, but I couldn't find any help for setting it
> up.
> OR
> 3. Configuring the sendmail utility on Linux
> 

I believe that Zend_Mail would offer help here. It it a pure PHP
solution, and therefore should work on various operating systems.

Some code that uses Zend_Mail for sending out mail is at
git://git.savannah.nongnu.org/bibledit. See directory web/web in there.
We use smtp.gmail.com as the external SMTP server, and it works well.
Zend_Mail handles all authentication needed: SMTP: smtp.gmail.com, auth
=> login, username => YOUR_USERNAME@xxxxxxxxx, password =>
YOUR_PASSWORD, ssl => ssl, port => 465.

Teus.





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux