471,319 Members | 950 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

Mail function not working properly

119 100+

I am using mail function in my php page, As soon i update the details, i have to send mail to the customer with the updated details,

problem is when i send mail it simple through waring msg as:

Waring mail() [function mail]: SMPT sever response: 550 Relaying not allowed in d:/wamp/update.php
can anyone help me why such problem occurs, how to over come this problem.

Thanks in advance,

Oct 22 '09 #1
6 4909
8,656 Expert Mod 8TB
what’s the code you use?
Oct 22 '09 #2
119 100+
Expand|Select|Wrap|Line Numbers
  2. $to  = get_mail($phnumber);  // retrive mail id based on there ph number    
  3. $subject = 'order details';
  5. $message .= 'Order Details'; // html body
  7. // To send HTML mail, the Content-type header must be set
  8. $headers  = 'MIME-Version: 1.0' . "\r\n";
  9. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  11. // Additional headers
  12. $headers .= 'To: '. $to . "\r\n";
  13. $headers .= 'From: <order@example.com>' . "\r\n";
  15. // Send Mail
  16. mail($to, $subject, $message, $headers);    
This is the simple code i used here, but no use of it, mail goes once for 5 times, other mail returns with above said Warning

please help how to over come this,

Thanks in advance

Oct 22 '09 #3
8,656 Expert Mod 8TB
how does $to look like?
Oct 22 '09 #4
119 100+
k then make it as

$to = 'magesh.apr@example.com';

the final $to value will be this only.


Oct 22 '09 #5
8,656 Expert Mod 8TB
probably the Windows sentmail chokes on <order@example.com>. try it without < >, although the error implies that example.com is not your current host name…
Oct 22 '09 #6
How To: PHP Sendmail and XAMPP on Windows

It can be difficult getting the PHP’s default mail functions to work when you run an apache server on windows instead of a unix environment. I ran into this problem with my server (running XAMPP), and thought others may benefit from a quick how-to. Another slight problem I had to get working was using an SMTP server that requires SSL connections (gmail for one). I didn’t realize that most recent XAMPP releases have sendmail built in already. This takes part of the hassel out, but we still have some configuring to do.
First, ensure that you have an XAMPP release that does include the fake sendmail program. [More details here]
Next, go to the XAMPP directory (often C:\xampp\), then open the ’sendmail’ subdirectory. You’ll most likely see the following files (default):
Open the file sendmail.ini – this is where all of your SMTP server configurations will go, for example: SMTP Username, Password, Host, Port, etc
My sendmail.ini file looks something like this:
; configuration for fake sendmail
; SMTPS (SSL) support
; auto = use SSL for port 465, otherwise try to use TLS
; ssl = alway use SSL
; tls = always use TLS
; none = never try to use SSL
; if your smtp server requires authentication, modify the following two lines
auth_password=<PASSWORD HERE>
Note that this is a very simple setup. The variable names are fairly obvious, so simply fill in the SMTP server, port, ssl mode, username, password, and default domain / error log if you’d like.
GMail requires an SSL connection, so my config was setup to use SSL port 465 and smtp_ssl=auto. If SSL is not necessary for your SMTP server, simply set smtp_ssl=none.
Once the configuration is setup, make sure to save changes, then exit.
If you are going to use SSL connections, you will need two additional files, available here "http://glob.com.au/sendmail/sendmail-SSL.zip" (as of March 2009) – if this link no longer works, use the contact form and let me know.
Extract the two compressed files (libeay32.dll and ssleay32.dll) to the same directory as sendmail.exe (for me, C:\xampp\sendmail\)
Now, everything on the sendmail’s end is setup – now we just need to let the server know its there!
Edit your PHP.ini file:
XAMPP installations often have multiple files. If you are doubtful of the correct one, you can always go through and change them all. But before you do that, change the php.ini in \xampp\apache\bin\.
Look for the following line:

sendmail_path = " \“C:\xampp\sendmail\sendmail.exe \" -t”
Uncomment the line (if already commented) by removing the semicolon at the start.
Ensure that the path to sendmail.exe is correct (this is correct for me).
Save and exit php.ini
Restart the apache server and everything should work!
Comment if you have a question.
Nov 25 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

11 posts views Thread by ColinWard | last post: by
reply views Thread by James | last post: by
6 posts views Thread by sellam | last post: by
7 posts views Thread by r0g | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.