Sending Mail from mail() Function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
saadatshah
Forum Newbie
Posts: 23
Joined: Fri Jul 05, 2002 5:50 am
Location: Lahore

Sending Mail from mail() Function

Post 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....
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

i uselly use it like:

Code: Select all

mail("$email","$subject","$body","From:$from");
saadatshah
Forum Newbie
Posts: 23
Joined: Fri Jul 05, 2002 5:50 am
Location: Lahore

Post 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
User avatar
PaTTeR
Forum Commoner
Posts: 56
Joined: Wed Jul 10, 2002 7:39 am
Location: Bulgaria
Contact:

Post 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:
Post Reply