email with php problems

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
User avatar
abionifade
Forum Commoner
Posts: 34
Joined: Thu Apr 18, 2002 5:32 pm

email with php problems

Post by abionifade »

hi guys,

im having difficulty in activating the mail function within php.

I have entered the outgoing smtp address and sendmail address within php.ini.

I have created a script to send email which errors on line 4.....

I am completely baffed as to how this could all possibly work, afterall, from the tutorials that ive been through, there was nowhere which asked me to enter my email accounts password...

is there something that i am doing wrong or have overlooked?

So far i have configured

php.ini

anything else to configure to make this mail thing work? 8O

Code: Select all

<?php
if ($BeenSubmitted) &#123;
         if ($MailTo) &#123;
                 if (mail($MailTo, $Subject, $Body, "From: $MailFrom")) &#123;
                         print ("<B><CENTER><FONT COLOR=BLUE>Your email has been successfully sent!</FONT></CENTER></B>\n");
                 &#125; else &#123;
                         print ("<B><CENTER><FONT COLOR=RED>Your email was not successfully sent due to a system error!</FONT></CENTER></B>\n");
                 &#125;
         &#125; else &#123;
                 print ("<B><CENTER><FONT COLOR=RED>Please enter the recipient's mail to address!</FONT></CENTER></B>\n");
         &#125;
&#125;
?>
<FORM ACTION="email_student.php" METHOD=POST>
Recipient's Email Address: <INPUT TYPE=TEXT NAME="MailTo" SIZE="50"><BR>
Your Email Address: <INPUT TYPE=TEXT NAME="MailFrom" SIZE="50"><BR>
Email Subject: <INPUT TYPE=TEXT NAME="Subject" SIZE="80"><BR>
Email Body:<TEXTAREA NAME="Body" ROWS="10" COLS="50"></TEXTAREA><P>
<INPUT TYPE=HIDDEN NAME=BeenSubmitted VALUE=TRUE>
<INPUT TYPE=SUBMIT NAME="SUBMIT" VALUE="Submit!">
</FORM>

Many thanks

-Abi
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

What is the error?

Mac
User avatar
abionifade
Forum Commoner
Posts: 34
Joined: Thu Apr 18, 2002 5:32 pm

Post by abionifade »

Warning: Unknown error in c:\program files\apache group\apache\htdocs\sis\primary\final\email_student.php on line 4

Your email was not successfully sent due to a system error!
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

abionifade wrote:Warning: Unknown error
Well that's nice and helpful isn't it :D.

Are you sure that you've got the correct SMTP server name? Because the error probably means that you can't connect to the SMTP server to send the mail (as you know). Check with your ISP if you aren't sure.

Mac
User avatar
abionifade
Forum Commoner
Posts: 34
Joined: Thu Apr 18, 2002 5:32 pm

Post by abionifade »

thanks for getting back to me on this one...

assuming that i have got the correct smtp address, im wondering how the heck it autheticates me without the use of a password??

thats why im thinking do i need to configure anything to have my username and password for my mail acct?

Thanks :)
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

What I've always assumed (and could be entirely wrong) the SMTP server you would generally use is your ISP's and since you're already connected to them (through dialup, broadband whatever) they authenticate you that way.

All SMTP is is a protocol for sending mail between servers, you don't need your username or password because you aren't accessing your own e-mail messages which would be stored on a POP3 or IMAP server. All the SMTP servers I've used have had a different name than the POP3 or IMAP server that you use to retrieve your mail.

Mac
Post Reply