Page 1 of 1

Sending Mail from mail() Function

Posted: Sat Jul 13, 2002 6:00 am
by saadatshah
////// sending mail

print (mailSender("test@test.com"));



/////////// mail sending function

function mailSender($strMailTo){

$strSubject="Wellcome to Shop Spot";

$strBody="This a Welcome Mail.....Your request is in process...When the site administrator aprove you..You will get an email.. ";

$strMailFrom="saadi_shah@hotmail.com";

return mail($strMailTo,$strSubject,$strBody,$strMailFrom);

}

///// ended


...now come to the problem this code sends mail from an address "nobody@myserver.com".....

but i wanna send this mail from "info@myserver.com"....

what chang i should make in above code..so that it send mail from info@myserver.com".....

can anyone figure it out....

Posted: Sat Jul 13, 2002 6:03 am
by qads
i uselly use it like:

Code: Select all

mail("$email","$subject","$body","From:$from");

Posted: Sat Jul 13, 2002 6:34 am
by saadatshah
hi,
thx dear its workin...but one problem is this....the mail script i ve written above take 2 long 2 finish.....

sometimes it gives the zero sized rely error...and sometimes it gives script time out error...but in all the cases...the recepient recieve the mail .......now tell me how can i remove this problem...and mak my script fast ....i m in a waiting condition...so plz asnwer fast....

thx

Posted: Sat Jul 13, 2002 6:54 am
by PaTTeR
If you script gives 'Time out' use this in begin of file

Code: Select all

set_time_limit(0);
This wll fix the 'time out' problem.

If u use the mail() functoin, header "From: nobody@something.com" is still send. You can solve this with Mail class comes with php source.

Sorry for my english :wink: