Exforsys

Free Training

send mail in Php?

This is a discussion on send mail in Php? within the PHP forums, part of the Programming Talk category; i want to send an automatic mail in a php script.i can use mail() fuction but it is not working.how ...

Go Back   Exforsys > Programming Talk > PHP

Exforsys.com

  #1 (permalink)  
Old 11-09-2006, 12:53 AM
Junior Member
 
Join Date: Feb 2006
Posts: 15
Prabhu N is on a distinguished road
send mail in Php?

i want to send an automatic mail in a php script.i can use mail() fuction but it is not working.how to resolve this problem?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-09-2006, 08:14 AM
Senior Member
 
Join Date: Apr 2005
Posts: 721
lokeshm is on a distinguished road
Correct syntax for mail function is
@mail('<<email-id>>','<<subject>>',<<message>>,<<header>>);

It should work, Why it is not working
What error message are you getting
Post the error message here let us see...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-05-2006, 05:59 AM
Senior Member
 
Join Date: Apr 2006
Posts: 125
ashlee is on a distinguished road
As you said you ahve used mail() function and you are not getting kindly place the error you got and how you used mail() function so that I could help you out in this.

One way of using the mail() function is as follows:

PHP Code:
$send_to = "exa@xxx.com";
$subject = "Example";
$message = 'Example Message';
$headers = "From: sas@test.com";
$headers .= "\r\n" . 'X-Mailer: PHP/' . phpversion();
mail($send_to, $subject, $message, $headers);

This code adds two headers. You could add others or comment out the second one. If multiple headers are present they need to be separated by a carriage return/line feed.

You can also set the default From: in your php.ini.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
problems using php mail function falco85 PHP 7 10-16-2008 10:20 AM
Php Tutorials and ebooks cybot PHP 1 04-14-2007 03:01 AM
Send Mail Using SMTP mahehs_k_anjani Microsoft .NET 1 11-15-2006 01:01 PM
Hiring freshers hr_Joseph Freshers Jobs 0 05-26-2005 12:56 PM
Send upto 1GB attachment to any mail sanereddy Chit-Chat 0 07-22-2004 09:17 PM


All times are GMT -4. The time now is 02:31 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0
Copyright 2004 - 2009 Exforsys Inc. All rights reserved.