Jump to content

mail configuration


asmith

Recommended Posts

i've install my php not on the a real domain on net, but local,

so i'm using simply "http://localhost/"  , and i'm using apache .

 

for the activation link for the registered users, i found out the codes, in some part i have :

 

/ send e-mail to ...

$to=$email;

 

// Your subject

$subject="Your confirmation link here";

 

// From

$header="from: your name <your email>";

 

// Your message

$message="Your Comfirmation link \r\n";

$message.="Click on this link to activate your account \r\n";

$message.="http://www.yourweb.com/confirm.php?passkey=$confirm_code";

 

// send email

$sentmail = mail($to,$subject,$message,$header);

 

.

.

.

 

i wanted to know should't i configure anything in my php.ini  for sending e-mails ? i hvn't done any changes in that file, last changes was main changes to make it work ...

so what should i do  to still use my localhost ? (i'm just training and studing php) can i send mail with my "http://localhost/" ?

Link to comment
Share on other sites

can i send mail with my "http://localhost/" ?
Short answer - no, not directly. You need a public mail server.

 

There are two problems - The php mail() function "looks" like an un-authenticated email client. You also don't have an email server on your localhost computer (and just for learning and testing - installing, configuring, and meeting all the DNS requirements for an email server is out of the question.)

 

You can send an email to or through your email account at an ISP, but you would need to use SMTP authentication (username/mailbox name and password) against that email account, which the php mail() function does not support.

 

To do this you need to use one of the php mailer classes, such as phpmailer http://phpmailer.codeworxtech.com/ or swiftmailer http://www.swiftmailer.org/

 

You basically need to make php look like an authenticated SMTP (sending only) email client. Actual settings vary by ISP and most ISP's have instructions for sending to/through them from a php script. If they don't have php specific instructions, just use typical instructions for setting up a client program like Outlook.

 

The good news is that once you get your code working with one of the php mailer classes, you only need to change settings when you put your code onto a live web server.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.