|
-
Jul 15th, 2009, 10:36 AM
#1
Thread Starter
Lively Member
php mail
While searching the net I found a rather simple lines of code for sending email.
PHP Code:
$to = "[email protected]"; $subject = "site feedback"; $message = stripslashes(trim($_POST['mssg'])); $from = "[email protected]"; $headers = "From: ".$_POST['user']; mail($to,$subject,$message,$headers);
I know, this is not ALL, there has to be more to it. I have not specified mail server and stuff like that. How can I set it up on my site?
I am running wampserver and email page is in localhost. Can I send email from my desktop? I found 2 more lines of code to be appended before mail(), these are:
It refuses to work. here is the error message:
Warning: mail() [function.mail]: SMTP server response: 501 5.7.1 < [email protected]>... Sender refused by the DNSBL xbl.spamhaus.org
Last edited by sridharao; Jul 15th, 2009 at 11:01 AM.
Save trees, avoid plastics, say no to zoo, go veg, recycle as much, live holistic
-
Jul 15th, 2009, 03:36 PM
#2
Re: php mail
using mail() assumes that you have a mail server to use. you can set it up in the INI file, but most SMTP servers require authentication and the mail() function lacks the ability to authenticate you to outside servers (like hotmail, gmail, or your ISP's mail server). instead, you could use the PHPMailer class to send mail.
-
Jul 15th, 2009, 10:07 PM
#3
Thread Starter
Lively Member
Re: php mail
I checked out PHPmailer. I am stuck right at the beginning. The documentation states;
Copy class.phpmailer.php into your php.ini include_path. If you are using the SMTP mailer then place class.smtp.php in your path as well.
On a server where my site is hosted, how can I do that?
The mail server available to me is mail.mydomain.com
How do I proceed from here?
further additions:
These are the folders installed in wamp folder; alias, appa, bin, lang, logs, scripts, tmp, www
"Copy class.phpmailer.php into your php.ini include_path." Where is that?
I located php.ini at C:\wamp\bin\php\php5.2.9-1. In this file is an entry ";include_path = ";include_path = ".;c:\php\includes"" but there is no such folder in C: drive. So, where should I place class.phpmailer.php
Also noted that there is a folder named pear inside php5.2.9-1 folder. How can I use pear mail?
Last edited by sridharao; Jul 21st, 2009 at 09:04 AM.
Save trees, avoid plastics, say no to zoo, go veg, recycle as much, live holistic
-
Jul 21st, 2009, 09:04 AM
#4
Thread Starter
Lively Member
Re: php mail
I am still waiting for reply
-
Jul 21st, 2009, 03:02 PM
#5
-
Jul 22nd, 2009, 09:12 AM
#6
Thread Starter
Lively Member
Re: php mail
Ok,
The problem is solved, Thanks for the link. In fact, the documentation of phpmailer itself was clear enough. I had to struggle a bit in placing the class.phpmailer.php in the require statement. A little search and got the answer.
All is well, except that the mails sent in this fashion is considered spam and gets delivered straight into spam or junk folder. Why could this be so?
Last edited by sridharao; Jul 22nd, 2009 at 08:51 PM.
Save trees, avoid plastics, say no to zoo, go veg, recycle as much, live holistic
-
Jul 24th, 2009, 04:46 AM
#7
Re: php mail
probably has to do with your mail headers, the content of your mail, or your domain's MX records. I really can't provide any help to fix your problem though.
-
Jul 25th, 2009, 08:25 AM
#8
Thread Starter
Lively Member
Re: php mail
It's working, as you said it had something to do with MX records. Really, PHPmailer is indeed a boon to webmasters.
-
Aug 3rd, 2009, 08:01 AM
#9
Addicted Member
Re: php mail
I'm sending a html page to an email address through a godaddy server and when it is received by the recipient, it shows it's from that server as one would expect.
What can I do with '$headers' or others that would allow people to answer / reply to my own email address because otherwise the person repling gets a failure message from godaddys server?
I know I can put in a weblink but is there an easy - more common option for users.
-
Aug 3rd, 2009, 09:29 AM
#10
Re: php mail
Sounds like you're not setting the From header correctly.
Additionally, you can set Reply-to, but this is usually only used if the reply address is specifically different from the originating address. In either case From should be set.
-
Aug 4th, 2009, 03:57 AM
#11
Addicted Member
Re: php mail
Reply-to works great thanks penagate
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|