Ok to answer your questions.
The "send out through SMTP" should be part of your apache addons, its not really a separate install... you have to enable SMTP in both your php.ini file (the one being used by the server, be carefull sometimes there are more then 1 php.ini file) and on your server too.... I assume you are using Apache.
in your active php.ini file, (if you are using apache, go into your apache folder under BIN folder and there should be a php.ini file in there, that is the active one)
uncomment the line here:
extension=php_smtp.dll <------------------
then look for the following lines:
[mail function]
; For Win32 only.
SMTP = smtp.yourdomain.com
smtp_port = 25
; For Win32 only.
sendmail_from =
noreply@yourdomain.com
Ok in your PHPMAILER you only require a couple of the php files.
class.phpmailer.php and class.smtp.php
In the class.phpmail.php
edit the following lines:
public $From = '
noreply@yourdomain.com';
public $FromName = 'Name you want to display in the From field in your email';
public $Mailer = 'mail';
public $Host = 'smtp.yourdomain.com';
public $Port = 25;
public $SMTPAuth = true;
<--- this is if your smtp requires a password!
public $Username = '
noreply@yourdomain.com';
<---- Make sure this is an ACTUAL EMAIL BOX!
public $Password = 'MyPassword1';
<---- Actual password for logging into that email box
Now save that...
Edit class.smtp.php
public $SMTP_PORT = 465;
<-- this is the port that you can use to send out your email.... I use SHAW CABLE for my ISP and they block 25 but they don't block 465... if your ISP blocks 25, you may need to change port 25 in the other file as well, but try it like how I have it first... Remember some mail sites requrire a specific SMTP port so make sure you check forums for the proper smtp port....
I noticed you are trying to use hotmail... that's really iffy... You
may need to use a secure connection to the smtp.. this requires more work in your php files... Im not sure about this for hotmail, but you definitely need it for Gmail!. If you need to, set the following for however you would need to for hotmail. (only if it is required) you will need to activate SSL on your server settings and uncomment the line that deals with ssl in your php.ini file....
$host = "ssl://smtp.gmail.com";
public $Host = 'ssl://smtp.yourdomain.com'; etc. so keep an eye open for that.
It would be much easier for you to create a
noreply@yourdomain.com email box and use the registrar's email smtp server in my oppinion. As far as I know, it is more streamline to use and generally doesn't use SSL.
here is an example of an email sent from from PHP mailer, this would go in whatever file you want to send the email from.
Code: Select all
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->From = "noreply@yourdomain.com";
$mail->FromName = "Name displayed in from field";
$mail->Host = "smtp.yourdomain.com";
$mail->Mailer = "smtp";
<p>Dear '.$firstname.';</p>
<p>Thank you for registering!<br>
Note: This message is automated, so please do not reply.</p>
<p><strong>Your username is:</strong> <span class="style3">'.$newun.'</span><br>
<strong>Your password is:</strong> <span class="style3">Protected for security puroposes</span><br>
<strong>Your referer id is:</strong> <span class="style3">'.$uid.'</span></p>
<p>To complete your registration and begin using us, please click on the link below.</p>
<p class="style4">Activate now: <a href="http://www.exampledomain.com/activate.php?activ='.$activecode.'">http://www.ehapi.com/activate.php?activ='.$activecode.'</a></p>
<p>Once you have clicked on the link, you will be brought to the login page and will be able to access the member’s area.</p>
<p>Good luck!</p>
<p>Sincerely,</p>
<p>Your Admin and your referrer: '.$ref.'</p>';
// Plain text body (for mail clients that cannot read HTML)
$text_body = "Hello " . $firstname . " " . $lastname . ", \n\n";
$text_body .= "Thank you for registering with us!.\n\n";
$text_body .= "Note: This message is automated, so please do not reply. \n";
$text_body .= "Your username is: ".$newun."";
$text_body .= "Your password is: Protected for security";
$text_body .= "Your referer id is: ".$uid."";
$text_body .= "";
$text_body .= "To complete your registration and begin using us, please copy and paste the URL ";
$text_body .= "below into your browser address bar and hit enter.";
$text_body .= "";
$text_body .= "http://www.exampledomain.com/activate.php?activ=".$activecode."";
$text_body .= "";
$text_body .= "Once you have clicked on the link, you will be brought to the login page and will be able";
$text_body .= "to access the member’s area.";
$text_body .= "";
$text_body .= "Good luck!";
$text_body .= "";
$text_body .= "Sincerely,";
$text_body .= "Your Admin and your referrer: ".$ref."";
$mail->Subject = "Welcome to Example Domain - Please Activate Your Account";
$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddAddress($email, $firstname." ".$lastname);
//$mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");
if(!$mail->Send()) {
echo "There has been a mail error sending to " . $email . " please try again<br>";
// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
$mail->ClearAttachments();
exit;}
$mail->ClearAddresses();
$mail->ClearAttachments();
//finish mail
Are you hosting your own site or are you using a service??? If you are hosting your own, what server are you using including version?
Good luck, took me a good couple days to figure out how to get email out with my domain's SMTP because I'm hosting my own site until its fully opperational..
By the way, if you are not hosting your own site on your own server, and you are using a professional hosting company, you shouldn't have SMTP port problems.
Let me know how it goes!