SMTP configuration
Posted: Sun Apr 18, 2010 4:47 pm
Hi all, I'm new to PHP and have just installed mysql, apache and php. I have been learning the different things in the PHP language and I have got to learning about forms.
I'm stuck on sending an email via a PHP script. I don't know much about SMTP other than it is some sort of protocol to transfer simple messages.
I understand that the php.ini file needs modifying under the [mail function] and I have made the following changes below. I am quite confused regarding the SMTP, can i only use the one that my internet provider has? Also does the sendmail_from field have to be an email address from that particular SMTP? And what exactly is an SMTP? :
I am using mobile broadband from T-Mobile.
My PHP script looks like this :
The result of running this script is :
[text]Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first in C:\server\public_html\email.php on line 9
Mail Sent[/text]
Does this have something to do with authentication or by using a different SMTP would the script work?
If you could shed some light on the theory and practical implementation of SMTP it would be highly appreciated. I have browsed quite a few articles on the subject but find it ambiguous in places. I was also thinking about using the gmail SMTP but thought I get the basics right first.
Thanks
I'm stuck on sending an email via a PHP script. I don't know much about SMTP other than it is some sort of protocol to transfer simple messages.
I understand that the php.ini file needs modifying under the [mail function] and I have made the following changes below. I am quite confused regarding the SMTP, can i only use the one that my internet provider has? Also does the sendmail_from field have to be an email address from that particular SMTP? And what exactly is an SMTP? :
Code: Select all
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.t-mail.co.uk
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = myemail@msn.comMy PHP script looks like this :
Code: Select all
<?php
$to = "someone@hotmail.com";
$subject= "test";
$message= "Hello! this is a simple email message";
$from ="someoneelse@hotmail.com";
$headers = "From: $from";
mail($to,$subject,$message,$from,$headers);
echo "Mail Sent";
?>
The result of running this script is :
[text]Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first in C:\server\public_html\email.php on line 9
Mail Sent[/text]
Does this have something to do with authentication or by using a different SMTP would the script work?
If you could shed some light on the theory and practical implementation of SMTP it would be highly appreciated. I have browsed quite a few articles on the subject but find it ambiguous in places. I was also thinking about using the gmail SMTP but thought I get the basics right first.
Thanks