Hi Maciek, admin, Thanks for your responses. Its really helpful. Regards Ashwani On Wed, May 23, 2012 at 3:37 PM, Maciek Sokolewicz < maciek.sokolewicz@xxxxxxxxx> wrote: > On 23-05-2012 06:12, Ashwani Kesharwani wrote: > >> Hi , >> >> I have a query w.r.t. mail() function in php. >> >> I have hosted my site and i have created an email account as well. >> >> when i am sending mail to different recipient from my php script using >> above function it is getting delivered to respective recipients as >> expected. >> >> However if I want to see those mail in the sent folder of my email account >> , i can not see those mails there. >> >> How can I achieve this. >> >> Any suggestions. >> >> Regards >> Ashwani >> >> > Simply put: the email account you have created is being ignored by the > mail() function. > > It doesn't matter if you created an email account or not; if I wanted to, > I could make mail() send emails from president@xxxxxxxxxxxxxx or from > kofi.annan@xxxxxx. The mails would never appear in their outboxes, simply > because an outbox or sent mail folder is a local copy of your mail, made by > the mail client. It has nothing, intrinsically, to do with emailing anyone. > > If I try email someone, this happens: > 1. I load my mail client > 2. I type my mail and press send > 3. My mail client stores a copy of this mail in the sent folder > 4. My mail client contacts the server, and tells it that it has a mail > from me, to a certain adress, and then hands it over. > 5. My mail client tells me "mail sent successfully" > > If I use PHP's mail function, the following happens: > 1. The PHP script is ran > 2. The mail() function is invoked with the email message to send as a > string > 3. The mail() function starts up a local program called sendmail (or a > program which does roughly the same thing), which it then gives the entire > message to send to. > 4. sendmail contacts the server, and tells it that it has a mail from me, > to a certain adress, and then hands it over. > 5. the mail() function says "mail sent succesfully" > > So, as you can see, the storage of the email in the sent box has nothing > to do with actual sending of the mail, but purely with the use of your mail > client, which PHP does not use (obviously). If you really do want to store > the email, you'll have to do it yourself. "admin" (which is an annoying > nickname on the internet! Please change it!) has already showed you a few > ways to do so. >