By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,376 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

PHP Mail Confusion

100+
P: 228
Hi guys,
I am really,really confused about mail servers and their use. I want to send email from my php and someone told to install a mail server. I installed argosoft mail server and it says it has sent the email address and i can see a report in argosoft that it has recieved a message from my server(localhost). But what i want is to send the email to an external server, say i wanna send email to phpcrazy@yahoo.com. How can i do that? What is the role of mail servers here and which one would you recommend me to use in my site?
Dec 22 '07 #1
Share this Question
Share on Google+
7 Replies


Markus
Expert 5K+
P: 6,050
Are you using the php mail() function?

merry christmas
Dec 22 '07 #2

100+
P: 228
Are you using the php mail() function?

merry christmas
yes. i used mail() function.
Dec 22 '07 #3

Markus
Expert 5K+
P: 6,050
Can you show us the code you're using please?

Thanks :)

p.s. i mean the code you use to send the email

i.e.
<?php
mail(...)
?>
Dec 22 '07 #4

realin
100+
P: 254
you can simply send a mail without having to install any server on php .. i am using mail() function to send mails from PHP and never installed a server on it.. come on ..

here is a simple example from php.net

[PHP]
<?php
// The message
$message = "Line 1\nLine 2\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail('caffinated@example.com', 'My Subject', $message);
?>
[/PHP]

cheers !!
Dec 22 '07 #5

Markus
Expert 5K+
P: 6,050
you can simply send a mail without having to install any server on php .. i am using mail() function to send mails from PHP and never installed a server on it.. come on ..

here is a simple example from php.net

[PHP]
<?php
// The message
$message = "Line 1\nLine 2\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail('caffinated@example.com', 'My Subject', $message);
?>
[/PHP]

cheers !!
That's what i was going to see if he was using...

Why would you install a mail server when PHP has one built in?

- markus.
Dec 22 '07 #6

100+
P: 228
here is the code guys....it is pretty the same thing, but it never sends emails:

$sendto=$_POST[department];
$sendto.="@yahoo.com";
$msg=trim($_POST[msg]);

$sender=trim($_POST[email]);
$name=trim($_POST[name]);
$msg.="\r\r\r$name";
$sendmsg=@mail($sendto,'Site Visitor',$msg,'From: $sender');
if(!$sendmsg) {
echo "Dearest $name,<br><br>There was an error sending your email. Please send email to <a href=\"mailto:webmaster@anberbeb.com?subject=Error Seding Email\">webmaster</a> to notify us about the accurance of this problem.";
}
else {
echo "Dearest $name,<br><br>Thank you for your email. You will be contacted shortly by an Authorized personel from Anberbeb Share Comapny.<br><br>Greetings,<br>Anberbeb Share Company";
}
}

i expected the installation of a mail server would solve the problem...but no.
Dec 28 '07 #7

P: 6
Hi,

If you are using Windows XP or Windows 2003 you will need to install SMTP service, however if you set you ip address as 127.0.0.1 or localhost, Hotmail,Yahoo and Gmail will reject your email that is sent out from your pc

You will find your rejected mail in

C:\Inetpub\mailroot\Badmail



Subject: Delivery Status Notification (Failure)

This is a MIME-formatted message.
Portions of this message may be unreadable without a MIME-capable mail program.

--9B095B5ADSN=_01C8439CD875BFE200000007suv00111
Content-Type: text/plain; charset=unicode-1-1-utf-7

This is an automatically generated Delivery Status Notification.

Delivery to the following recipients failed.

xxx@hotmail.com




--9B095B5ADSN=_01C8439CD875BFE200000007suv00111
Content-Type: message/delivery-status

Reporting-MTA: dns;xx00111
Received-From-MTA: dns;suv00111
Arrival-Date: Fri, 28 Dec 2007 18:50:58 +1200

Final-Recipient: rfc822;xx@hotmail.com
Action: failed
Status: 5.0.0
Diagnostic-Code: smtp;550 DY-001 Mail rejected by Windows Live Hotmail for policy reasons. We generally do not accept email from dynamic IP's as they are not typically used to deliver unauthenticated SMTP e-mail to an Internet mail server. http://www.spamhaus.org maintains lists of dynamic and residential IP addresses. If you are not an email/network admin please contact your E-mail/Internet Service Provider for help. Email/network admins, please visit http://postmaster.live.com for email delivery information and support
Dec 30 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.