I`M USING THE PHP MAIL FUNCTION TO SEND EMAILS TO MEMBERS IN MY SITE.

sendto="xxxxxxx@yahoo.com";
$to=$sendto;
$from="From:mysite@mysite.com \r\n";
$subject="$fullname contacted mysite";
$content="$message \r\n his/her email address is $email";
if($content){
mail($to, $subject, $content,$from);

echo"<font color=green>Your email was sent successfuly to adminstration of mysite.<br/><a href=index.php>Continue to the site</a></font>";
}

i dont know how to make it like in Tagged,facebook etc when u receive a notification in your inbox eg yahoo,it shows :
from subject
tagged john contacted mysite
facebook john contacted mysite

When i send email by removing @mysite.com and remaining mysite from $from="From:mysite@mysite.com \r\n"; strange thing happens, thus to say mysite@server403.webhostingpad.com.
i hope u`ve understood me.HELP PLEASE.

Recommended Answers

All 3 Replies

Firstly I would change this part

sendto="xxxxxxx@yahoo.com";
// TO THIS // 
$sendto="xxxxxxx@yahoo.com";

You may have cut that part out with the copy and paste

Personally I use this and it works the way I want it to.

mail($receiver_email, $subject, $msg, 'FROM: MySite.com');

Other member's on this site are pros at this stuff and I hope they correct me if I'm wrong, but it's been my experience that if you leave this part out

$from="From:mysite@mysite.com \r\n";

The message looks like this [email]mysite@server403.webhostingpad.com[/email] when it is received.

What you have there looks like it should be okay.

Here is an email class that I made. I have never had problems with it.

It also allows for attachments as well.

Example usage:

$email = new email;
$email->to('test@test.com','test@gmail.com'); //allows for multiple to addresses
//or you can call the to() function again.
//carbon copies are allowed using $email->cc('emailaddress');
//blind carbon copies are allowed using $email->bcc('emailaddress');
$email->from('Name','no-reply@sample.com'); //provide a name and a from address
$email->subject('Subject here'); //add a subject
$email->message('Message text\n\nMore text','text'); //if you want to use html just replace 'text' with 'html'
//attachments are allowed using $email->attach('path/to/file.ext','Name.ext','mime-type');
$email->send(); //sends email(s)

Or you can just use the code as an example so you can what you did wrong.

thank You all 4 contribution...i`m working with your ideas.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.