[PHP] Email from php
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 Alternaltly, any URLs giving the entire picture are also welcome. So far, I have only found info that is almost verbatim copy of the PHP manual. They just explain the different mail libraries and functions without considering the mail servers and all the back end. Thanks for taking the trouble to read! Regards, Ferdi
Re: [PHP] Email from php
On 19 May 2010 13:27, Ferdi ferdinan...@printo.in 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 Alternaltly, any URLs giving the entire picture are also welcome. So far, I have only found info that is almost verbatim copy of the PHP manual. They just explain the different mail libraries and functions without considering the mail servers and all the back end. Thanks for taking the trouble to read! Regards, Ferdi Easiest is (if you're on *nix) to setup an MTA like postfix or exim to relay emails from the localhost. Then get a good mail library like Swiftmailer and point that to the local MTA. Typically, that's about the setup you need to do (if you keep things simple, that is: if you want to mess about with postfix/exim you'll see days or months go by). Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Email from php
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 Alternaltly, any URLs giving the entire picture are also welcome. So far, I have only found info that is almost verbatim copy of the PHP manual. They just explain the different mail libraries and functions without considering the mail servers and all the back end. Thanks for taking the trouble to read! Regards, Ferdi Have you tried just sending mail directly from sendmail? If you can, see if it gives any error messages there. Also, try sending the email to several accounts, as the settings of one email account may be marking the email as spam. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Email from php
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_usern...@gmail.com, 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
Re: [PHP] Email from php
Ferdi writes: 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(). IMAP is only incoming (at least, the protocol is - the clue is in the name Internet Message Access Protocol - I can't say anything about imap_mail). I agree with others, the easiest solution is a local MTA such as sendmail, or, preferably, something more simple. 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. Oof. Yes, most remote/ISP MTAs these days will require some kind of authentication, which is why it is best (IMO) to use a local MTA. It won't mean you don't have to authenticate to the remote MTA, but it will push the responsibility of configuring the MTA onto someone who knows what it's all about. 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) What happens if you type 'man mail'? 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. You can try sending email from the commandline using 'mail' or even sendmail, to see if it works. You could try installing something simple locally (i.e. as your user), perhaps msmtp, which is a piece of cake to setup, especially compared with stuff like sendmail (which it is, anyway, compatible with, to a large extent). 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. A simple config to send mail through Google Apps for Domains via a local msmtp installation follows: #-- defaults host smtp.googlemail.com tls on tls_starttls on port 587 tls_trust_file /home/YOUR_USER/.certs/equifax.pem tls_cert_file tls_key_file auth on logfile ~/.logfiles/msmtp.log account foo from f...@yourdomain user f...@yourdomain password YOUR_PASSWORD_HERE #-- You'll need to get the referenced tls_trust_file but I forget where from. It will be different anyway, depending on the system - for example from looking at the msmtp docs it seems you can simply install a package on Debian. 3. Configuring the sendmail utility on Linux From what I remember, I wouldn't recommend sendmail :) It's really complicated, and probably overkill for what you want. -- Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[Fwd: Re: [PHP] email through PHP]
thanks to all for the kind support. i resolved the problem, i would like to share the same with you:- 1. made the changes in php.ini (gave sendmail path) 2. gave my smtp server ip address and name in /etc/hosts file 3. gave my smtp server name in /etc/mail/sendmail.mc file 4. then made sendmail.cf file from sendmail.mc file. now i am able to send the mail to outside through PHP. pls feel free to give your suggestion on the above. once again thanks to all with best wishes balwant -Forwarded Message- From: Balwant Singh [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Ken [EMAIL PROTECTED], php-general@lists.php.net Subject: Re: [PHP] email through PHP Date: 19 Apr 2005 17:15:11 +0530 thanks for your email, i read the manual and already tried the setting as told by you but its not working. i would like to again inform that i want to send email through PHP which is on a linux machine and our Company SMTP sever is on Windows Machine. i am certain the somebody has already tested it and can give me solution. pls help. with best wishes balwant On Tue, 2005-04-19 at 17:20, Angelo Zanetti wrote: why dont you read the manual, thats what its for. I know you can specify your smtp server setttings in your php.ini file. so just set your smtp to the windows server address from PHP.ini [mail function] ; For Win32 only. SMTP = smtp.myserver.com ; for Win32 only ; For Win32 only. sendmail_from = [EMAIL PROTECTED]; for Win32 only ; For Unix only. You may supply arguments as well (default: sendmail -t -i). ;sendmail_path = hope this helps Angelo Zanetti Z Logic [c] +27 72 441 3355 [t] +27 21 464 1363 [f] +27 21 464 1371 www.zlogic.co.za Balwant Singh wrote: i want to use the SMTP server which is already exists. pls. give more details.. with best wishes balwant On Tue, 2005-04-19 at 15:59, Ken wrote: On 19 Apr 2005 15:04:08 +0530, Balwant Singh [EMAIL PROTECTED] wrote: hi, I am using FEDORA 3 and PHP. I want to send email to outside by my above mentioned linux machine through PHP. For this i want to use my SMTP sever, which is on a WINDOWS machine Please inform what setting to be done in php.ini or any other file to send the email. with best wishes balwant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php erm, isn't it easier to have the smtp on your fedora box instead...? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] email through PHP
hi, I am using FEDORA 3 and PHP. I want to send email to outside by my above mentioned linux machine through PHP. For this i want to use my SMTP sever, which is on a WINDOWS machine Please inform what setting to be done in php.ini or any other file to send the email. with best wishes balwant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] email through PHP
On 19 Apr 2005 15:04:08 +0530, Balwant Singh [EMAIL PROTECTED] wrote: hi, I am using FEDORA 3 and PHP. I want to send email to outside by my above mentioned linux machine through PHP. For this i want to use my SMTP sever, which is on a WINDOWS machine Please inform what setting to be done in php.ini or any other file to send the email. with best wishes balwant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php erm, isn't it easier to have the smtp on your fedora box instead...? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] email through PHP
i want to use the SMTP server which is already exists. pls. give more details.. with best wishes balwant On Tue, 2005-04-19 at 15:59, Ken wrote: On 19 Apr 2005 15:04:08 +0530, Balwant Singh [EMAIL PROTECTED] wrote: hi, I am using FEDORA 3 and PHP. I want to send email to outside by my above mentioned linux machine through PHP. For this i want to use my SMTP sever, which is on a WINDOWS machine Please inform what setting to be done in php.ini or any other file to send the email. with best wishes balwant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php erm, isn't it easier to have the smtp on your fedora box instead...? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] email through PHP
why dont you read the manual, thats what its for. I know you can specify your smtp server setttings in your php.ini file. so just set your smtp to the windows server address from PHP.ini [mail function] ; For Win32 only. SMTP = smtp.myserver.com ; for Win32 only ; For Win32 only. sendmail_from = [EMAIL PROTECTED]; for Win32 only ; For Unix only. You may supply arguments as well (default: sendmail -t -i). ;sendmail_path = hope this helps Angelo Zanetti Z Logic [c] +27 72 441 3355 [t] +27 21 464 1363 [f] +27 21 464 1371 www.zlogic.co.za Balwant Singh wrote: i want to use the SMTP server which is already exists. pls. give more details.. with best wishes balwant On Tue, 2005-04-19 at 15:59, Ken wrote: On 19 Apr 2005 15:04:08 +0530, Balwant Singh [EMAIL PROTECTED] wrote: hi, I am using FEDORA 3 and PHP. I want to send email to outside by my above mentioned linux machine through PHP. For this i want to use my SMTP sever, which is on a WINDOWS machine Please inform what setting to be done in php.ini or any other file to send the email. with best wishes balwant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php erm, isn't it easier to have the smtp on your fedora box instead...?
Re: [PHP] email through PHP
check out phpmailer http://phpmailer.sourceforge.net/ use it all the time - its brilliant !!! Balwant Singh wrote: hi, I am using FEDORA 3 and PHP. I want to send email to outside by my above mentioned linux machine through PHP. For this i want to use my SMTP sever, which is on a WINDOWS machine Please inform what setting to be done in php.ini or any other file to send the email. with best wishes balwant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] email through PHP
thanks for your email, i read the manual and already tried the setting as told by you but its not working. i would like to again inform that i want to send email through PHP which is on a linux machine and our Company SMTP sever is on Windows Machine. i am certain the somebody has already tested it and can give me solution. pls help. with best wishes balwant On Tue, 2005-04-19 at 17:20, Angelo Zanetti wrote: why dont you read the manual, thats what its for. I know you can specify your smtp server setttings in your php.ini file. so just set your smtp to the windows server address from PHP.ini [mail function] ; For Win32 only. SMTP = smtp.myserver.com ; for Win32 only ; For Win32 only. sendmail_from = [EMAIL PROTECTED]; for Win32 only ; For Unix only. You may supply arguments as well (default: sendmail -t -i). ;sendmail_path = hope this helps Angelo Zanetti Z Logic [c] +27 72 441 3355 [t] +27 21 464 1363 [f] +27 21 464 1371 www.zlogic.co.za Balwant Singh wrote: i want to use the SMTP server which is already exists. pls. give more details.. with best wishes balwant On Tue, 2005-04-19 at 15:59, Ken wrote: On 19 Apr 2005 15:04:08 +0530, Balwant Singh [EMAIL PROTECTED] wrote: hi, I am using FEDORA 3 and PHP. I want to send email to outside by my above mentioned linux machine through PHP. For this i want to use my SMTP sever, which is on a WINDOWS machine Please inform what setting to be done in php.ini or any other file to send the email. with best wishes balwant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php erm, isn't it easier to have the smtp on your fedora box instead...? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] email through PHP
http://phpmailer.sourceforge.net/extending.html Balwant Singh wrote: hi, I am using FEDORA 3 and PHP. I want to send email to outside by my above mentioned linux machine through PHP. For this i want to use my SMTP sever, which is on a WINDOWS machine Please inform what setting to be done in php.ini or any other file to send the email. with best wishes balwant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Email with PHP.
Well I have install the second version from the end :) .. in a slack box with the latest apache server.. I tried to use the mail() function and it says that: Warning: mail() is not supported in this PHP build in . . . . . Well I notice that I haven't got sendmail installed, and so I installed it. I also configures the php.ini file to use sendmail. DO I NEED 2: 1. reinstall php with any special flag to use mail() function ?? 2. or do I need to do anything else.?? Thanks in advance.. -- Sapilas/dev/pinkeye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Email with PHP.
There's no special flag to compile the mail function. If you've installed it and it still doesn't work, try giving the path to sendmail in the line sendmail_path in php.ini In my file this line is commented out, seems like php detected the sendmail exec. at configure time. Well I have install the second version from the end :) .. in a slack box with the latest apache server.. I tried to use the mail() function and it says that: Warning: mail() is not supported in this PHP build in . . . . . Well I notice that I haven't got sendmail installed, and so I installed it. I also configures the php.ini file to use sendmail. DO I NEED 2: 1. reinstall php with any special flag to use mail() function ?? 2. or do I need to do anything else.?? Thanks in advance.. -- Sapilas/dev/pinkeye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -Pushkar S. Pradhan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Email-based PHP-Script
Hello List, I'm currently trying to setup a script which is processing incomming emails. So I setup PHP as CGI and did configurate the email like robot |/path/to/the/script.php The little testscript I tried looks like that: ? $fp = fopen(php://stdin,r); while (!feof($fp)) { $BUFFER = fgets($fp); $INPUT .= $BUFFER; } mail ([EMAIL PROTECTED], Test, $INPUT, From: [EMAIL PROTECTED]); fclose($fp); ? The error which I get is /path/to/the/script.php: cannot open ?: no such file 554 5.3.0 unknown mailer error 2 Does anybody have some PHP code which would work to readout incomming emails or knows that's wrong with my little script? Thanks a lot. Juergen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Email-based PHP-Script
Hi http://www.linuks.net/robot.phps best regards attila strauss Hello List, I'm currently trying to setup a script which is processing incomming emails. So I setup PHP as CGI and did configurate the email like robot |/path/to/the/script.php The little testscript I tried looks like that: ? $fp = fopen(php://stdin,r); while (!feof($fp)) { $BUFFER = fgets($fp); $INPUT .= $BUFFER; } mail ([EMAIL PROTECTED], Test, $INPUT, From: [EMAIL PROTECTED]); fclose($fp); ? The error which I get is /path/to/the/script.php: cannot open ?: no such file 554 5.3.0 unknown mailer error 2 Does anybody have some PHP code which would work to readout incomming emails or knows that's wrong with my little script? Thanks a lot. Juergen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Email-based PHP-Script
Hello, does anybody know of any documentation how to write scripts that do interact with emails (Majordomo-like), i.e. when an email comes to [EMAIL PROTECTED] that a script is starting which reads the email and completes tasks which are defined within the email? We are using PHP4, Apache and Sendmail. Thanks a lot. Juergen -- pro.vider.de Internetagentur GmbH Juergen Mueller Clichystr. 6 89518 Heidenheim Tel.: 07321 48 08 -72 Fax: -73 --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Email-based PHP-Script
does anybody know of any documentation how to write scripts that do interact with emails (Majordomo-like), i.e. when an email comes to [EMAIL PROTECTED] that a script is starting which reads the email and completes tasks which are defined within the email? Compile PHP as a binary and pipe the email directly from sendmail into PHP on STDIN Jon -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07763 620378 PGP Key available, send email with subject: Send PGP Key -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]