For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > January 2006 > send mail to someone









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author send mail to someone
Tommy DN

2005-12-03, 6:55 pm

This code works and send me e-mail:
---
$recipient="email@mydomain.com";
$subject="subject";
$header="From: " . $_POST['emailadres'];
$mail_body= $_POST['commentaar'];
mail($recipient, $subject, $mail_body, $header);
---
But when I want to send automatic e-mail ( when a user registers ) then
the code doesn't work.

So I changed $recipient to another e-mail adress that isn't mine:
---
$recipient="someotheremail@someisp.com";
$subject="subject";
$header="From: " . $_POST['emailadres'];
$mail_body= $_POST['commentaar'];
mail($recipient, $subject, $mail_body, $header);
---
So when I check someotheremail@someisp.com ... there's no mail :-(

What's wrong? Can I only send e-mail to my own domain and not to
somebody else? What's the solution???
Java Boy

2005-12-03, 6:55 pm


make sure your smtp server allow relaying ...

--
Gs Home
www.fahimzahid.com




"Tommy DN" <nospam@nospam.com> wrote in message
news:fK-dnV1o1eJiiA_eRVnyuA@scarlet.biz...
> This code works and send me e-mail:
> ---
> $recipient="email@mydomain.com";
> $subject="subject";
> $header="From: " . $_POST['emailadres'];
> $mail_body= $_POST['commentaar'];
> mail($recipient, $subject, $mail_body, $header);
> ---
> But when I want to send automatic e-mail ( when a user registers ) then
> the code doesn't work.
>
> So I changed $recipient to another e-mail adress that isn't mine:
> ---
> $recipient="someotheremail@someisp.com";
> $subject="subject";
> $header="From: " . $_POST['emailadres'];
> $mail_body= $_POST['commentaar'];
> mail($recipient, $subject, $mail_body, $header);
> ---
> So when I check someotheremail@someisp.com ... there's no mail :-(
>
> What's wrong? Can I only send e-mail to my own domain and not to
> somebody else? What's the solution???



Ian

2005-12-03, 6:55 pm

Tommy DN wrote:
> This code works and send me e-mail:
> ---
> $recipient="email@mydomain.com";
> $subject="subject";
> $header="From: " . $_POST['emailadres'];
> $mail_body= $_POST['commentaar'];
> mail($recipient, $subject, $mail_body, $header);
> ---
> But when I want to send automatic e-mail ( when a user registers ) then
> the code doesn't work.
>
> So I changed $recipient to another e-mail adress that isn't mine:
> ---
> $recipient="someotheremail@someisp.com";
> $subject="subject";
> $header="From: " . $_POST['emailadres'];
> $mail_body= $_POST['commentaar'];
> mail($recipient, $subject, $mail_body, $header);
> ---
> So when I check someotheremail@someisp.com ... there's no mail :-(
>
> What's wrong? Can I only send e-mail to my own domain and not to
> somebody else? What's the solution???


How is your mail server configured? If it isn't setup with an outgoing
SMTP server, it will not be able to forward mail to another domain.

Ian
Philip Ronan

2005-12-03, 6:55 pm

"Tommy DN" wrote:

> This code works and send me e-mail:
> ---
> $recipient="email@mydomain.com";
> $subject="subject";
> $header="From: " . $_POST['emailadres'];
> $mail_body= $_POST['commentaar'];
> mail($recipient, $subject, $mail_body, $header);
> ---


Your code is absolute crap. See if you can work out what would happen with
the following POST data:

emailadres = "tommy.dn@example.com
Cc: spam.me@example.com
Bcc: spam.me.also@example.com
Content-Type: text/html"

commentaar="<HTML><BODY><H1>CHEAP V.I.A.G.R.A FOR $ALE!!!!!</H1>...etc..."

Until you figure out how to avoid problems like this, I suggest you remove
all your email scripts from your website.

By the way, your mail probably isn't reaching its recipient because of a
spam filter somewhere.

--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/

Tommy DN

2005-12-06, 7:55 am

Tommy DN wrote:
> This code works and send me e-mail:
> ---
> $recipient="email@mydomain.com";
> $subject="subject";
> $header="From: " . $_POST['emailadres'];
> $mail_body= $_POST['commentaar'];
> mail($recipient, $subject, $mail_body, $header);
> ---
> But when I want to send automatic e-mail ( when a user registers ) then
> the code doesn't work.
>
> So I changed $recipient to another e-mail adress that isn't mine:
> ---
> $recipient="someotheremail@someisp.com";
> $subject="subject";
> $header="From: " . $_POST['emailadres'];
> $mail_body= $_POST['commentaar'];
> mail($recipient, $subject, $mail_body, $header);
> ---
> So when I check someotheremail@someisp.com ... there's no mail :-(
>
> What's wrong? Can I only send e-mail to my own domain and not to
> somebody else? What's the solution???


Now, it works. But there was a serious delay. I recieved all mails the
day after.
Jim Michaels

2006-01-16, 7:56 am

I was told I had to set the From: address to an email address on the server
for things to work.
Is this true?

"Philip Ronan" <invalid@invalid.invalid> wrote in message
news:BFB7D83A.3BEF6%invalid@invalid.invalid...
> "Tommy DN" wrote:
>
>
> Your code is absolute crap. See if you can work out what would happen with
> the following POST data:
>
> emailadres = "tommy.dn@example.com
> Cc: spam.me@example.com
> Bcc: spam.me.also@example.com
> Content-Type: text/html"
>
> commentaar="<HTML><BODY><H1>CHEAP V.I.A.G.R.A FOR $ALE!!!!!</H1>...etc..."
>
> Until you figure out how to avoid problems like this, I suggest you remove
> all your email scripts from your website.
>
> By the way, your mail probably isn't reaching its recipient because of a
> spam filter somewhere.
>
> --
> phil [dot] ronan @ virgin [dot] net
> http://vzone.virgin.net/phil.ronan/
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com