Skip to main content
GameDev.net gamedev.net
🔒 Locked

[web] mail()

Started by MilfredCubicleX Sep 3, 2006 at 9:12 PM 12 replies 4.4k views
Original Post
MilfredCubicleX
MilfredCubicleX
It seems that mail() has suddenly stopped working on my school webspace, so i'm looking for an alternative while I wait for a reply from one of the guys that works in IT here. If it turns out that they decided to suddenly stop supporting mail then i'm in trouble and i definately need an alternative ( right now i'm using it for email activation for a php game... so in the meantime i'm sending out the activation emails by hand :( ) If anyone can help me out i'd be very appreciative, google didn't turn up any real help.
Limitz
Limitz
The easiest way would be to find another server that can use mail and post your data there and let that script send the mail.
You can also implement your own SMTP protocol in php but then sockets must be enabled. Just open a TCP connection to a smtp server on port 25 and go from there.

google smtp protocol
php sockets

Greetings.
Sander
Sander
You could download phpBB and grab the e-mailer class from the includes/ directory. phpBB's e-mailer class already supports remote SMTP servers through sockets.
MilfredCubicleX
MilfredCubicleX
Hmm, well after googling around I found a script that would send a mail through SMTP which seemed to work ok, until i found out it only sent messages to address' with the tcnj domain, so i'm going to look for another solution. I'd really rather use a script that doesn't use authorized SMTP because I don't like having my password in plaintext... I'll check out phpBB.

MilfredCubicleX
MilfredCubicleX
Well, i tried a script that uses authorized smtp but to no avail. Here is the error I keep getting when trying to send mail not in the tcnj domain ( the error gets mailed to my email address ):

The original message was received at Mon, 4 Sep 2006 14:04:14 -0400 (EDT)
from localhost [127.0.0.1]

----- The following addresses had permanent fatal errors -----
[email address removed]
(reason: 554 5.7.1 : Client host rejected: Access
denied)

----- Transcript of session follows -----
... while talking to mailhost.tcnj.edu:
>>> DATA
<<< 554 5.7.1 : Client host rejected: Access denied
554 5.0.0 Service unavailable
<<< 554 5.5.1 Error: no valid recipients

What does this mean? ..
Sander
Sander
Ofcourse. You should open the source of the script and make it connect to the SMTP server of either the school or the (central) mailserver of the school's network. You can't connect to any random SMTP server on the net and hope that it works. That's what spammers do!
markr
markr
What you should do, is fix mail() to make it work.

What symptom do you get? Does the MTA* log show anything?

Is mail reaching no destinations at all, or is it still arriving at some? If so, it may have been blacklisted.

Usually the MTA logs are the best place to look to find out the problem.

If you don't have access to them, raise a support ticket with the person who's supporting it.

Mark

* MTA = Mail Transfer Agent, e.g. Sendmail, exim etc.
MilfredCubicleX
MilfredCubicleX
Quote:
Original post by Sander
Ofcourse. You should open the source of the script and make it connect to the SMTP server of either the school or the (central) mailserver of the school's network. You can't connect to any random SMTP server on the net and hope that it works. That's what spammers do!


But i set the SMTP server to "localhost" and mailing to my own address worked fine. I also tried smtp.tcnj.edu which is apparently the smtp server of my school but that did not work.

Quote:
Original post by markr
What you should do, is fix mail() to make it work.

What symptom do you get? Does the MTA* log show anything?

Is mail reaching no destinations at all, or is it still arriving at some? If so, it may have been blacklisted.

Usually the MTA logs are the best place to look to find out the problem.

If you don't have access to them, raise a support ticket with the person who's supporting it.

Mark

* MTA = Mail Transfer Agent, e.g. Sendmail, exim etc.


I really would love to have mail() fixed. I emailed the guy in charge of all this but he hasn't got back to me yet. I have no idea where to find the MTA log. The symptoms i got with mail() was that it just suddenly stopped sending mail. No mail is being recieved at all.

MilfredCubicleX
MilfredCubicleX
Ahh this is so frustrating! mail() seems to only be able to send mail to anyone with a tcnj.edu email account! i tried my yahoo and gmail account and never recieved an email!!! BAH!
Sander
Sander
Quote:
Original post by MilfredCubicleX
Ahh this is so frustrating! mail() seems to only be able to send mail to anyone with a tcnj.edu email account! i tried my yahoo and gmail account and never recieved an email!!! BAH!


Looks like your sysadmin has reconfigured the MTA to make it spammer proof. You should really talk to him about this.

MilfredCubicleX
MilfredCubicleX
Hmm, I did email him Saturday and am still waiting for a response, so I guess that's it. Thanks to everyone for the help.
lucky_monkey
lucky_monkey
So you're attempting to send mail through smtp.tcnj.edu? Here's what I get:
220 cyrus.TCNJ.EDU ESMTP Postfix
ehlo test
250-cyrus.TCNJ.EDU
250-PIPELINING
250-SIZE 20480000
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
help
502 5.5.2 Error: command not recognized
mail from:<my email address here>
250 2.1.0 Ok
rcpt to:<a second email address here>
554 5.7.1 <a second email address here>: Relay access denied
data
554 5.5.1 Error: no valid recipients
rset
250 2.0.0 Ok
quit
221 2.0.0 Bye

It doesn't support the authentication mechanisms with which I am familiar (AUTH ...), just TLS (indicated by the STARTTLS EHLO option) which has something to do with SSL and certificates and I can't really be bothered reading up on it. This means however that you've only got the one auth method available so whatever script you use to send the email has to know how to authenticate using the STARTTLS option.


The error message
>>> DATA<<< 554 5.7.1 <venom.TCNJ.EDU[159.91.15.183]>: Client host rejected: Access denied554 5.0.0 Service unavailable<<< 554 5.5.1 Error: no valid recipients
is pretty weird since it contains three error messages from the server in response to your single DATA command (the second error message, '554 5.0.0 Service unavailable', isn't prefixed by <<< but your client probably didn't send it since it's a server side SMTP error message.)
MilfredCubicleX
MilfredCubicleX
The saga continues, their response:

"We have recently started having problems with spammers sending out
massive amounts of email using PHP pages and CGI programs of our users.
This is primarily the result of poorly written pages/programs that could
be tricked into letting the spammer set the To, From, Subject and
message body. Because of these actions, the college has had it email
server listed multiple times on SpamCop and Comcast which has prevented
us from corresponding with many sites. In order to combat this issue,
rules have been configured on our email server to only accept emails
destined for @tcnj.edu address from the campus web servers. There is
currently no "fix" to allow your web page/program to directly send to
off-campus addresses.

Sorry for the inconvenience."


MEH!
Sander
Sander
There is a fix, but they'll have to set it up differently:

Configure their WEBSERVERS to only allow mail for the campus, then give out authorisation credentials to access the central mailservers for those web applications that CAN be trusted. Ofcourse, this is a lot more work to set up than what they currently implemented....

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.