8 Replies - 3708 Views - Last Post: 25 July 2012 - 03:12 AM Rate Topic: -----

#1 badrbarca  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 05-April 12

probleme with sending an email

Posted 06 June 2012 - 03:04 AM

Hello everyone in local i try to send a message to my email
<?php 

ini_set('SMTP','smtp.live.com');                           
ini_set("sendmail_from","Myemail@mail.xx");    
mail('Myemail@mail.xx', 'hello', 'message');

echo "<HTML><HEAD>";
echo "<TITLE>Formulaire envoyer!</TITLE></HEAD><BODY>";
echo "<H1 align=center>Merci, </H1>";
echo "<P align=center>";
echo "Votre formulaire à bien été envoyé !</P>";
echo "</BODY></HTML>";

?> 

but i still have this error SMTP server response: 530 5.7.0 Must issue a STARTTLS command first
can anybody help, I shall be grateful

Is This A Good Question/Topic? 0
  • +

Replies To: probleme with sending an email

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3719
  • View blog
  • Posts: 5,990
  • Joined: 08-June 10

Re: probleme with sending an email

Posted 06 June 2012 - 03:56 AM

Looks like the SMTP server requires an encrypted connection, via SSL/TSL. You'll have to adapt the host name and most likely set another port. I'm not sure if this will work, but it's worth a try.
ini_set("SMTP", "ssl://smtp.live.com");
ini_set("smtp_port", "587");



If not, you may want to try something more powerful than the simple mail function built into PHP. Libraries like Swift Mailer and PHPMailer have support for secure connections, amongst other things. They should be able to handle this.
Was This Post Helpful? 0
  • +
  • -

#3 paydayloan  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 6
  • Joined: 24-July 12

Re: probleme with sending an email

Posted 24 July 2012 - 03:00 AM

I have problem regarding email sending code. I am new to php so i am not much familiar with php. I have written code for email sending for that i retrieve the email id from the database and want to sent email on that email id.The code is as below
<?php
$username=$_POST['uname'];

$con=mysql_connect("localhost","root","") or ("Cannot connect localhost");

mysql_select_db('project',$con) or die("connection field");

$q=mysql_query("select email from admin where uname='$username'");

$numrows=mysql_num_rows($q);

if($numrows!=0)
{
    while( $row=mysql_fetch_assoc($q))
    {
        $emailid = $row['email'];
    }
        $to = $emailid;
        $subject = "Test mail";
        $message = "Your security code is .";
        $from = "abc.sample@gmail.com";
        $headers = "From:" . $from;
            mail($to,$subject,$message,$headers);
        echo "Mail Sent.";

}
else 
    die ("That username doesnot exist");
?> 


It is showing me error as
"Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() on line 29 "
The code on line 29 is" mail($to,$subject,$message,$headers); " .
Please help me out. Thanks in advance.
Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6063
  • View blog
  • Posts: 23,515
  • Joined: 23-August 08

Re: probleme with sending an email

Posted 24 July 2012 - 03:06 AM

You have an error telling you EXACTLY what the problem is:

Quote

Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() on line 29


So now, go to the Mail Configuration part of the manual and set your server up properly.
Was This Post Helpful? 1
  • +
  • -

#5 paydayloan  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 6
  • Joined: 24-July 12

Re: probleme with sending an email

Posted 25 July 2012 - 01:53 AM

View PostJackOfAllTrades, on 24 July 2012 - 03:06 AM, said:

You have an error telling you EXACTLY what the problem is:

Quote

Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() on line 29


So now, go to the Mail Configuration part of the manual and set your server up properly.


Thank you sir i have checked it, it is working. And other way to solve it is, when these files are uploaded on the server it automatically sends the mail it does not show any error.
Was This Post Helpful? 0
  • +
  • -

#6 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1003
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: probleme with sending an email

Posted 25 July 2012 - 02:34 AM

View Postpaydayloan, on 25 July 2012 - 09:53 AM, said:

Thank you sir i have checked it, it is working. And other way to solve it is, when these files are uploaded on the server it automatically sends the mail it does not show any error.

Because the server has a mail server installed on it?
Was This Post Helpful? 1
  • +
  • -

#7 vectorialpx  Icon User is offline

  • New D.I.C Head

Reputation: 7
  • View blog
  • Posts: 28
  • Joined: 16-July 12

Re: probleme with sending an email

Posted 25 July 2012 - 02:46 AM

use phpmailer.
You need the php openssl extension.

check
http://phpmailer.wor...xamplebsendmail
or
https://www.google.c...pmailer+example
Was This Post Helpful? 0
  • +
  • -

#8 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1003
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: probleme with sending an email

Posted 25 July 2012 - 03:10 AM

View Postvectorialpx, on 25 July 2012 - 10:46 AM, said:

use phpmailer.
You need the php openssl extension.

check
http://phpmailer.wor...xamplebsendmail
or
https://www.google.c...pmailer+example

What for?
Was This Post Helpful? 0
  • +
  • -

#9 vectorialpx  Icon User is offline

  • New D.I.C Head

Reputation: 7
  • View blog
  • Posts: 28
  • Joined: 16-July 12

Re: probleme with sending an email

Posted 25 July 2012 - 03:12 AM

View PostRudiVisser, on 25 July 2012 - 03:10 AM, said:

What for?
You don't need a server. You can send with your google account :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1