Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

PHP Problems


  • Please log in to reply

#1
jrm-hosting

jrm-hosting

    Member

  • Member
  • PipPip
  • 79 posts
I have this contact page using php and I can't seem to send emails to the email address that I have provided.


<?
$to = "webmaster-hosting.com";
$name = $_POST['name'];
$email = $_POST['email'] ;
$subject = $_POST['subject'];
$comments = $_POST['comments'] ;

mail( $to, $subject, $name, "Feedback Form Results", $comments );
header( "Location: thankyou.htm" );
?>


When I use the contact page, when hit the submit button, I get redirected to the thankyou page but for something reason I'm not getting the comments etc... can someone please help me.


http://jrm-hosting.com/contact.html.


HELP me Please.


IIS 6 Exchange 2003

Edited by jrm-hosting, 28 January 2006 - 10:37 PM.

  • 0

Advertisements


#2
Hai Mac

Hai Mac

    Member

  • Member
  • PipPipPip
  • 260 posts
Hello,
so first thing is that you have to enter a valid EMAIL adress into the $to variable, not the domain. (so something like $to = "[email protected]" or simply your personal email adress)

Next, mail should be used like this:
mail(email,subject,message)
However it seems you tried to ram too many things into the mail function. Instead, rewrite it like this:
mail($to, $subject,"Feedback Form Results\n" . $name . "\n" . $email . "\n" . $comments);

Hope that helped :), if you have any further problems, don't hesitate and post it :tazz:
  • 0

#3
jrm-hosting

jrm-hosting

    Member

  • Topic Starter
  • Member
  • PipPip
  • 79 posts
Thanks for the input, for the to, I put it as that, but in my script I have the to set to my email address, and I have also tried the second part but I'm still not getting any emails. I guess my one and only problem is that, actually question, how should I configure php and IIS the proper way, because I think I have it configured right, but I don't know if something is missing, can you give me some quick tutorial on how to configure php? I have a looked everywhere and none of the tutorials seems to help me or they mostly have what I have in my php.ini configuration file.
http://jrm-hosting.com/index.php

mail($to, $subject,"Feedback Form Results\n" . $name . "\n" . $email . "\n" . $comments);


  • 0

#4
Hai Mac

Hai Mac

    Member

  • Member
  • PipPipPip
  • 260 posts
Hmm, unfortunately, I don't have experience with IIS. :). Try looking at your SMTP settings, may be they are not set properly.
You can also try to remove the header( "Location: thankyou.htm" ); thing, so that PHP will tell you any errors that occur, then post them here :tazz:
  • 0

#5
jrm-hosting

jrm-hosting

    Member

  • Topic Starter
  • Member
  • PipPip
  • 79 posts
Thanks, that's the thing, I have looked almost everywhere. I have removed the hearder redirect thing but still no error.

Edited by jrm-hosting, 29 January 2006 - 12:31 PM.

  • 0

#6
Hai Mac

Hai Mac

    Member

  • Member
  • PipPipPip
  • 260 posts
That's strange. Well, I found this page, it's fair enough but may be you already have look at this :tazz: : http://www.hostlibra...b-hosting-.html

Edited by Hai Mac, 29 January 2006 - 03:02 PM.

  • 0

#7
jrm-hosting

jrm-hosting

    Member

  • Topic Starter
  • Member
  • PipPip
  • 79 posts
Nice, but the question I have for you is that do I need to have MYSql install on my server, even if I'm not using it for any database used? Do I need MYSQL to use the Mailfunction? If that's the case I don't have mysql install on my server.
  • 0

#8
Hai Mac

Hai Mac

    Member

  • Member
  • PipPipPip
  • 260 posts
I am almost sure that is not the problem, I never tried mail() without mysql (but I know it didn't run even with mysql, but because I didn't have SMTP set correctly :tazz:)
  • 0

#9
jrm-hosting

jrm-hosting

    Member

  • Topic Starter
  • Member
  • PipPip
  • 79 posts
Ok, now, I have exchange 2003, can you tell me how to setup the SMTP server in order to have it working? And Also, I was thinking is IIS is a big problem I can just move to WAMP and use APACHE, but can you tell me how to setup Multiple sites in apache, that if you know how to!

Ant thanks for all your inputs

Edited by jrm-hosting, 30 January 2006 - 11:24 AM.

  • 0

#10
Hai Mac

Hai Mac

    Member

  • Member
  • PipPipPip
  • 260 posts
What is your email address? If your mail is hosted, you can search for their SMTP adress. Any mail will have two adresses: a POP3 to receive mails and a SMTP to send them. If you can get the SMTP adress, then you just copy it into the php.ini file (look for "[mail function]").

This is as far as my knowledge goes, initially I thought this problem was more related to programming....
  • 0

Advertisements


#11
jrm-hosting

jrm-hosting

    Member

  • Topic Starter
  • Member
  • PipPip
  • 79 posts
Well, I'm hosting my own email on exchange, but I'll try my hotmail or comcast email when I get home today!

[email protected] or [email protected]

Edited by jrm-hosting, 30 January 2006 - 11:56 AM.

  • 0

#12
Hai Mac

Hai Mac

    Member

  • Member
  • PipPipPip
  • 260 posts
Oh good, then have a look at your settings on Exchange, the addresses are 100% there (though I don't know where exactly). Try the email settings, they must somewhere there (or at least they tell you a hint, something like your SMTP adress is yourmail.yourdomain.com etc.)

Edited by Hai Mac, 30 January 2006 - 11:58 AM.

  • 0

#13
jrm-hosting

jrm-hosting

    Member

  • Topic Starter
  • Member
  • PipPip
  • 79 posts
At first I had it settup to my smtp IP address then put it to localhost but still nothing! Now, the question is if I use my Hotmail account will it go through?
  • 0

#14
Hai Mac

Hai Mac

    Member

  • Member
  • PipPipPip
  • 260 posts
If it is not a free account. I have (or had) a free account but they didn't let me access their SMTP :). And did you try smtp.jrm-hosting.com or smtp.jmetellus.jrm-hosting.com?

Or may be you can have a look at this http://www.microsoft...n/13x2kada.mspx. It is a fairly long winded stuff, but you might find some valuable clues.

Also try this page: http://email.about.c...qt/et021802.htm. It talks directly about PHP and mail.

Also in php.ini, set: smtp_port = 25

Oh, next thing, did you get rid of the semicolon before each setting? Because
; For Win32 only.
;SMTP = xx.xx.xx; for Win32 only
;smtp_port = 25
;sendmail_from= [email protected]; for Win32 only
won't work. Should be

; For Win32 only.
SMTP = xx.xx.xx; for Win32 only
smtp_port = 25
sendmail_from= [email protected]; for Win32 only
won't work

Hope that will help :tazz:
  • 0

#15
jrm-hosting

jrm-hosting

    Member

  • Topic Starter
  • Member
  • PipPip
  • 79 posts
Hai Mac, thanks for you help bro, I dont' know what happen, I have tried it with the smtp.jrm-hosting.com before but for some reason I tried it now and it works, so Thanks for you help again, my script is working now. THank you Sir!
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP