FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


How to send an email from a PHP script?





likeabreeze
How to send an email from a PHP script?
I asked google,
it told me that
Code:
mail(to,subject,message)
is enough.
I tried but failed.
Finally, I tried
Code:
mail(to,subject,message,"From: one@example.com")
, I have to mention that one@example.com is not the Return-To Email Address in Outgoing Email Settings, but two@example.com is.
it didn't work either.
I tried
Code:
mail(to,subject,message,"From: two@example.com")
, it worked.
why is that?
Another question here, the wordpress send emails to you from the email address wordpress@example.com. but this email doesn't exist.(it cant receive emails)
How to do this?
Possum
I have a php Email script on my page.. And all of a sudden its not working..... That may be your problem.. A glitch on FriHost..

Simple Form
prasadcool
likeabreeze wrote:
How to send an email from a PHP script?
I asked google,
it told me that
Code:
mail(to,subject,message)
is enough.
I tried but failed.
Finally, I tried
Code:
mail(to,subject,message,"From: one@example.com")
, I have to mention that one@example.com is not the Return-To Email Address in Outgoing Email Settings, but two@example.com is.
it didn't work either.
I tried
Code:
mail(to,subject,message,"From: two@example.com")
, it worked.
why is that?
Another question here, the wordpress send emails to you from the email address wordpress@example.com. but this email doesn't exist.(it cant receive emails)
How to do this?


The following code will surely work its just that your Port 25 must be blocked on your local machine
You can host the script, it will surely send mail
friend2012
The problem is due to From email id in mail_to function
From Email Id should always be that of the domain sending email. Only then email will be send. If you use other domain email, the email will fail.

If your website domain is website1.com from Email should be xyz@website1.com or abc@website1.com. But if you use abc@website2.com for From Email Id, the email will not be sent.

Set From mail to your domain name. Email will be sent definitely.
sonam
Here is post in my blog "How to build PHP mail form with spam protection". Maybe this can help you.

http://www.frihost.com/users/sonam/blog/vp-83950.html


Sonam
metalfreek
Ok, here is a php script to send mail

mail('mymail@myprovider.com', 'Contact Form', $message, 'FROM: '.$senderemail)

I use it to send email to myself when someone fills out my contact form.

Hope this helps.
Related topics
Phoenix free PHP scripts
error in my PHP script
how can i make a php script for enter username and password?
Inserting data to MYSQL with a PHP script
Running a "Hello World" php script
[PHP] Running Cron Jobs Via PHP Script
Simple PHP script not working
PHP Script- How can we install it
I need a VERY simple php script
PHP Script needed
Logging systeem php script
php login (with flash)
PHP script to create email addresses/ftp accounts/etc...
Sending Email from localhost
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.