[thelist] PHP Form Help

Maximillian Schwanekamp anaxamaxan at neptunewebworks.com
Wed Mar 31 17:15:02 CST 2004


>Hey I had the PHP form working on my server but when I ftp'd it to
>the domain hosted by godaddy.com I don't receive the email. Any idea whats
>wrong?

GoDaddy's hosting is horrible, at least for PHP (I speak from experience).
Many basic functions are disabled, including mail().  But you can use the
CDONTS COM object.  Here's a basic function to use on PHP 4+, with defaults
for HTML mail (might want to change that):

function send_email($to,$from,$msgsubject, $msg, $bodyformat = 0,
$mailformat = 0)
{
	/*CDONTS For Windows servers only*/
	@$CDONTS = new COM("CDONTS.NewMail");
	@$CDONTS->From = $from; // format: "Name <name at example.com>"
	@$CDONTS->To = $to; // format as above
	@$CDONTS->Subject = $msgsubject;
	@$CDONTS->BodyFormat = $bodyformat; // 0 = html, 1 = text
	@$CDONTS->MailFormat = $mailformat; // 0 = MIME, 1 = text
	//@$CDONTS->AttachFile("c:\tmp\somefile.txt");
	@$CDONTS->Body = $msg;
	@$CDONTS->Send();
	@$CDONTS->Close();
}

A quick reference for CDONTS can be had at:
http://www.devasp.com/Samples/mail.asp  (ASP-oriented tutorial, but it's the
same object)


Maximillian Von Schwanekamp
NeptuneWebworks.com
voice: 541-302-1438
fax: 208-730-6504




More information about the thelist mailing list