Hi frnds....


First of all sry for all 4 arraising same(email) thread more times...
I have a problem with email sendhing...

one my old client ...his project is shifted from one server to another server(control panel)...now, the contact page(email) is not working properly...here i m getting the below error....plz tell me wat i have to do....


error:

Failed to connect to mail.aaaaaaaa.com:25 [SMTP: Failed to connect socket: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (code: -1, response: )]

where can i write smtp settings for this attachment mail code...

Hi frnds....


First of all sry for all 4 arraising same(email) thread more times...
I have a problem with email sendhing...

one my old client ...his project is shifted from one server to another server(control panel)...now, the contact page(email) is not working properly...here i m getting the below error....plz tell me wat i have to do....


error:

Failed to connect to mail.aaaaaaaa.com:25 [SMTP: Failed to connect socket: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (code: -1, response: )]

where can i write smtp settings for this attachment mail code...

How are you sending mail? Please post the relevant PHP code.

You're SMTP host is not accepting any connections.
ie: mail.aaaaaaaa.com

When you switched providers, you should also have a new SMTP server address. To get the address, you can open up the shell (command line).

On windows: nslookup -type=mx example.com On linux: dig example.com mx

Hi digital-ether,

My php code working in one of our hosting server..but not working in some servers...this is my php code...Basically i dont know all about wat u said(switched providers,smtp server address)...so, plz be patience..and explain me clearly....


this is my php code..

<?php 
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$name= $fname.' '.$lname;
$edu=$_POST['edu'];
$email=$_POST['email'];
$gender=$_POST['gender'];
$date=$_POST['date'];
$month=$_POST['month'];
$year=$_POST['year'];
$address=$_POST['address'];
$mobile=$_POST['tel'];
$resume=$_FILES['resume']['name'];
$tresume=$_FILES['resume']['tmp_name'];
$dob=$date.'-'.$month.'-'.$year.'';
$subject="Career";



$email_message= "<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<title>Intemo Systems - Careers</title>
<style>
<!--
.title{
	font-size:18;
	font-family:Tahoma;
	font-weight:bold;
	color:#F78C02;
}
.label{
	font-size:14;
	font-family:Tahoma;
	font-weight:bold;
	color:#FBFBFB;
}
.text{
	font-size:12;
	font-family:Tahoma;
	color:#FFFFFF;
	line-height:20px;
}
.outline{
	outline: thin solid #FBFBFB;
}
hr{color:#77bc13}
table,tr,td{
	font-size:14;
	font-family:Tahoma;
	color:#000000;
}
-->
</style>
</head>

<body topmargin='0'>
<table width='100%' border='0' cellspacing='1' cellpadding='1' align='center'>
  <tr>
    <td colspan='3'>&nbsp;</td>
  </tr>
  <tr>
    <td  width='15%'>&nbsp;</td>	
    <td align='center' valign='middle'>
<table width='100%' border='0' cellspacing='2' cellpadding='2' bgcolor='#717171' class='outline'>
  <tr>
    <td colspan='3' class='title'>Intemo Systems - Careers</td>
  </tr>
  <tr>
    <td colspan='3'><hr></td>
  </tr>  
  <tr>
    <td align='left' valign='top' width='20%' class='label'>Name</td>
    <td align='left' valign='top' width='1%' class='label'>:</td>
    <td align='left' valign='top' width='*' class='text'>".$name."</td>
  </tr>
  <tr>
    <td align='left' valign='top' width='20%' class='label'>Qualification</td>
    <td align='left' valign='top' width='1%' class='label'>:</td>
    <td align='left' valign='top' width='*' class='text'>".$edu."</td>
  </tr>
  
   <tr>
    <td align='left' valign='top' class='label'>Gender</td>
    <td align='left' valign='top' class='label'>:</td>
    <td align='left' valign='top' class='text'>".$gender."</td>
  </tr><tr>
    <td align='left' valign='top' class='label'>Email</td>
    <td align='left' valign='top' class='label'>:</td>
    <td align='left' valign='top' class='text'>".$email."</td>
  </tr>
   <tr>
    <td align='left' valign='top' class='label'>Date of Birth</td>
    <td align='left' valign='top' class='label'>:</td>
    <td align='left' valign='top' class='text'>".$dob."</td>
  </tr>
  <tr>
    <td align='left' valign='top' class='label'>Address</td>
    <td align='left' valign='top' class='label'>:</td>
    <td align='left' valign='top' class='text'>".nl2br($address)."</td>
  </tr>
    <tr>
    <td align='left' valign='top' class='label'>Mobile Number</td>
    <td align='left' valign='top' class='label'>:</td>
    <td align='left' valign='top' class='text'>".$mobile."</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>

</table>	
	</td>
    <td  width='15%'>&nbsp;</td>
  </tr>
  <tr>
    <td colspan='3'>&nbsp;</td>
  </tr>  
</table>


</body>
</html>";


$fileatt = "upload/";
$fileatt_type =  "application/doc";
$fileatt_name = $fileatt. $resume;

$email_from = $email;
$email_subject = "Resume- Careers";
$email_txt = "attachment test-body";

$email_to = "aaaa@aaaaaaa.com";

$headers = "From: ".$email_from;

$file = fopen($fileatt_name,'rb');
$data = fread($file,filesize($fileatt_name));
fclose($file);

$fileatt_name = substr($fileatt_name, strlen($fileatt));

$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";

$email_message .= "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$email_message . "\n\n";

$data = chunk_split(base64_encode($data));

$email_message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";

$ok = @mail($email_to, $email_subject, $email_message, $headers);

if ($ok) {
    echo "<p>mail sent!</p>";
	header("location:careers.html?msg=Message Successfully sent"); 

} else {
    echo "<p>mail could not be sent!</p>";
	header("location:careers.html?msg=Message not sent!!"); 

}
?>

How are you sending mail? Please post the relevant PHP code.

You're SMTP host is not accepting any connections.
ie: mail.aaaaaaaa.com

When you switched providers, you should also have a new SMTP server address. To get the address, you can open up the shell (command line).

On windows: nslookup -type=mx example.com On linux: dig example.com mx

Did you already ask your hosting support about the issue. It looks like they have not set up the PHP configuration (PHP.ini file) properly.

The setup they have, has them send email through an SMTP server. From the error, it looks like the SMTP is hosted on Yahoo. However, that SMTP is not accepting connections.

An SMTP server (Simple Mail Transfer Protocol), is just like a web server. But instead of receiving and sending HTML pages, it receives and sends email.

The SMTP server (also called the Mail Transfer Agent, MTA) is responsible for receiving emails, as well as sending emails.

So in this case, PHP is set up to send emails through the SMTP server. However, that particular SMTP server address is not working.

plz i want to know how to get an smtp , and how i can creat it for the companies i designed some website for

Hi Digital_Eather,

Thanks 4 ur valuble suggestions.....problem solved by using diff code.....thanks once again...

Did you already ask your hosting support about the issue. It looks like they have not set up the PHP configuration (PHP.ini file) properly.

The setup they have, has them send email through an SMTP server. From the error, it looks like the SMTP is hosted on Yahoo. However, that SMTP is not accepting connections.

An SMTP server (Simple Mail Transfer Protocol), is just like a web server. But instead of receiving and sending HTML pages, it receives and sends email.

The SMTP server (also called the Mail Transfer Agent, MTA) is responsible for receiving emails, as well as sending emails.

So in this case, PHP is set up to send emails through the SMTP server. However, that particular SMTP server address is not working.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.