mail

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
mastaoneil
Forum Newbie
Posts: 6
Joined: Thu Aug 12, 2004 8:18 am

mail

Post by mastaoneil »

hi im having trouble sending email from php to my hotmail account

<?php
$to = "mastaoneil@hotmail.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body))
{
echo("<p>Message sent!</p>");
}
else
{
echo("<p>Message delivery failed...</p>");
}
?>

ive tryed it from a webhost but i get no email and it says Message delivery failed...

any1 help

cheers
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

send an email to that account, or better yet, several emails from differing accounts to that one. Get the headers from each of the emails that get through, and not into the junk folder. Compare the headers used by all of them. The ones that are in the same syntaxes are likely what's making it work.

the mail function is failing off your server provider, denying the email going out.. so you may need to check with them for what is required to send an email through their system. (Probably Reply-To and Return-Path)
mastaoneil
Forum Newbie
Posts: 6
Joined: Thu Aug 12, 2004 8:18 am

Post by mastaoneil »

send an email to that account, or better yet, several emails from differing accounts to that one. Get the headers from each of the emails that get through, and not into the junk folder. Compare the headers used by all of them. The ones that are in the same syntaxes are likely what's making it work.

how do i get the headers?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

viewtopic.php?t=22964&start=3

read the first post on that page...
mastaoneil
Forum Newbie
Posts: 6
Joined: Thu Aug 12, 2004 8:18 am

Post by mastaoneil »

but there is no email sent to me hotmail account so what should i do
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

send an email from your own account, to see what headers get through.. if you have other email accounts through other services, send some email with those accounts too. That way you can compare which headers are getting it through...
mastaoneil
Forum Newbie
Posts: 6
Joined: Thu Aug 12, 2004 8:18 am

Post by mastaoneil »

then wt do i do with the headers?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

feyd wrote:Compare the headers used by all of them. The ones that are in the same syntaxes are likely what's making it work.
mastaoneil
Forum Newbie
Posts: 6
Joined: Thu Aug 12, 2004 8:18 am

Post by mastaoneil »

do i have to run my own smtp server? and can i try alternative ways because i wont be hosting my site on my pc?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

what does that have to do with comparing the headers?
mastaoneil
Forum Newbie
Posts: 6
Joined: Thu Aug 12, 2004 8:18 am

Post by mastaoneil »

wts comparing headers got to do with sendin mail with php im not any gettin any mail sent
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

to make sure you're setting the right headers for the server to be able to send, normally..
Post Reply