|
-
Aug 14th, 2003, 12:56 AM
#1
Thread Starter
Member
PHP and Sendmail
I'm looking for an easy way to send mail based on information that is inputted into a form. I tried downloading a mail server, configuring it, and using a cgi script, but its not working, and with a delivery date of 8/17, I have little time to learn anything new. I've heard of qmail, but it only works on UNIX and the site I'm hosting it from uses Apache on a Windows machine. Any ideas or quick solutions would be greatly appreciated.
-
Aug 14th, 2003, 03:13 PM
#2
Frenzied Member
php has it's own mail function.
mail($to,$subject,$message,$extra_headers);
http://www.php.net/manual/en/ref.mail.php
-
Aug 14th, 2003, 04:50 PM
#3
Thread Starter
Member
Wait one second, let me get this straight.
So in order to use PHP's mail() function, I don't need a seperate mail app, nor do I need to learn sendmail? It sounds too good to be true!
Dont I still have to give PHP some SMTP address or is that taken care of as well? Cuz if so, then I'm back to where I started, unless you could tell me about a simple SMTP program so something like that.
-
Aug 14th, 2003, 08:49 PM
#4
Frenzied Member
if php is setup correctly and apache is setup correct you don't need anything.
is it your machine or a HOST?
if yours and you have an email addy then you can do it no problem.
-
Aug 15th, 2003, 12:19 AM
#5
Thread Starter
Member
Server Info
I run the site off of a seperate computer that uses Apache. I also have an AOL and Hotmail email accounts. Do I enter into the php config file the address of one of my email smtp's or will it work by itself?
-
Aug 15th, 2003, 09:15 AM
#6
Frenzied Member
you don't have email on the server that has php on it? is it your server? or a HOST?
-
Aug 15th, 2003, 08:47 PM
#7
Thread Starter
Member
Um...
It's my server, I host it from my dorm room via the UConn campus LAN, using Apache, with PHP installed. I am not hosting it using a third party domain or anything like that. All I have is a redirection link that brings people to my IP address, and my server has no mail server installed or like mail program. For email, I usually use Hotmail.
I am familiar now, after reading a few articles, how to set up the PHP code:
PHP Code:
<!-- The following code is on my submission page -->
<form method=post action="thanks.php">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Your Name:</td>
<td>
<input type="text" name="name">
</td>
</tr>
<tr>
<td>Your E-mail:</td>
<td>
<input type="text" name="theiremail">
</td>
</tr>
<tr>
<td valign="top">Your Message:</td>
<td>
<textarea name="message"></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="Submit" value="Send_Form">
</td>
</tr>
</table>
</form>
PHP Code:
<!-- then this code is at the top of my thanks.php page -->
<?php
if($sentemail == "2"){ //check to make sure ppl can't spam me
include("sorry.php"); //displays page if spamming
}else{
$num = $sentmessage + 1;
setcookie("sentemail","$num",time()+600); //set the cookie
$email = "Sender Name:\t$name\nSender E- Mail:\t$theiremail\nMessage:\t$message\nIP:\t$RE
MOTE_ADDR\n\n"; //sets email message
$to = "[email protected]";
$subject = "Site Message";
$mailheaders = "From: $theiremail <> \n";
$mailheaders .= "Reply-To: $theiremail\n\n";
mail($to, $subject, $email, $mailheaders); //sends mail
include("thanksecho.php"); //sends user to customized thank you page
}
?>
The mail section of my PHP.ini file is currently setup like this:
[mail function]
; For Win32 only.
SMTP = localhost
; For Win32 only.
sendmail_from = [email protected]
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
Once again, I am running windows on my server and must use another site's SMTP since there is no mail on my server. 1). How must I configure the [mail function] section of my php.ini file to reflect my situation. 2). Does my sendmail_from variable have to be from the same domain as the SMTP variable (i.e. if i use hotmail's SMTP address, should i use my hotmail email address as the sendmail_from variable/does it matter?)?
Hopefully this message is easier to understand. Thank you very much for your reply.
-
Aug 16th, 2003, 12:39 AM
#8
Thread Starter
Member
Appendages from everywhere!!!! Argh!
One more quick question: how long can a line of php code be? The $email string is going to be much longer than the one in the example. I know in JavaScript you can write:
my_variable = 'blah blah blah blah'
+ 'blah blah blah blah blah blah'
+ 'more blah blah blahs';
Can you do this in PHP if there is a problem with the length of a line of code?
Thanks
Last edited by UConnVendetta; Aug 16th, 2003 at 12:43 AM.
-
Aug 18th, 2003, 01:57 AM
#9
Frenzied Member
I understand what you need. I am just trying to understand how you have internet without email.
you could try to use your hotmail but I don't belive it will work. what you really want is somethign to the effect "mail.host.com"
but since you don't have one then you are out of luck. you will need to add a mail server to get it and then you are look at big bucks. what form of dialup do you have?
-
Aug 20th, 2003, 03:36 PM
#10
Stuck in the 80s
Re: Appendages from everywhere!!!! Argh!
Originally posted by UConnVendetta
One more quick question: how long can a line of php code be? The $email string is going to be much longer than the one in the example. I know in JavaScript you can write:
my_variable = 'blah blah blah blah'
+ 'blah blah blah blah blah blah'
+ 'more blah blah blahs';
Can you do this in PHP if there is a problem with the length of a line of code?
Thanks
In PHP:
Code:
$my_variable = 'blah blah blah blah'
. 'blah blah blah blah blah blah'
. 'more blah blah blahs';
or
Code:
$my_variable = 'blah blah blah blah';
$my_variable .= 'blah blah blah blah blah blah';
$my_variable .= 'more blah blah blahs';
-
Aug 20th, 2003, 05:50 PM
#11
Frenzied Member
or
PHP Code:
$my_variable = 'blah blah blah blah'
'blah blah blah blah blah blah'
'more blah blah blahs';
-
Aug 21st, 2003, 01:09 AM
#12
Stuck in the 80s
Originally posted by phpman
or
PHP Code:
$my_variable = 'blah blah blah blah'
'blah blah blah blah blah blah'
'more blah blah blahs';
He didn't ask for a parse error?
Edit: I even ran it to double check and that gave me a:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in d:\user files\kristopher\site\test.php on line 3
-
Aug 21st, 2003, 09:37 AM
#13
Frenzied Member
you are right, I left the single quotes in 
PHP Code:
$my_variable = 'blah blah blah blah
blah blah blah blah blah blah
more blah blah blahs';
-
Aug 21st, 2003, 11:50 AM
#14
Stuck in the 80s
Originally posted by phpman
you are right, I left the single quotes in 
PHP Code:
$my_variable = 'blah blah blah blah
blah blah blah blah blah blah
more blah blah blahs';
That's better.
-
Aug 25th, 2003, 12:39 PM
#15
Thread Starter
Member
BTW, before i start, thanks for help with my length of a variable question
Originally posted by phpman
I understand what you need. I am just trying to understand how you have internet without email.
you could try to use your hotmail but I don't belive it will work. what you really want is somethign to the effect "mail.host.com"
but since you don't have one then you are out of luck. you will need to add a mail server to get it and then you are look at big bucks. what form of dialup do you have?
I currently am running my server on my university's LAN. I have a problem with windows right now though, probably some virus or hacker got through before i updated my security so I'm re-installing windows.
I'm running Apache's HTTP Server. with no additional mail server. Before my comp crahsed, I was getting an error telling me that I was missing a from header or the sendmail_from variable in my php.ini file was missing. I included both, so maybe the problem is because I tried using a 3rd party's SMTP for mailing, but not using my email address for that site. I'm not sure what is wrong.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|