Jump to content


Photo

how to send mail use socket


  • Please log in to reply
4 replies to this topic

#1 zjp

zjp
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 08 July 2006 - 08:35 AM

who can give me the code?
thanks

#2 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 08 July 2006 - 08:43 AM

I am not sure what you mean but here is a standard script for sending mail.

$to = '$email_address';//the email address that you are sending to
    $subject = 'Your subject
    $message = '$This is were you type your email address';
    $headers = "From: your email_address
       'X-Mailer: PHP/' . phpversion() . "\r\n" .
       "MIME-Version: 1.0\r\n" .
       "Content-Type: text/html; charset=utf-8\r\n" .
       "Content-Transfer-Encoding: 8bit\r\n\r\n";
    mail($to, $subject, $message, $headers)or die('something went wrong');
    echo 'Your mail has been sent';

You should try to be more descryptive about your issue. I, for instance, have my own server and use the Mecury Mail Server, which has issues sending mail via php. The standard X-mailer will not work.

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#3 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 08 July 2006 - 08:48 AM

or maybe you could try this

$knownsender = "your email";
$mailtos = "sending to email";
$subject = "Your subject";
$message = "enter your message here";
    
    
}
if ($ccaddress=="" || $ccaddress==" ")
{
	$header="From: $knownsender";
	
}
else
{
	$header .="From: $knownsender\r\n";
	$header .=" Cc: $ccaddress";
}
// $header.="Bcc: $bcaddress";

if (@mail($mailtos, $subject, $message, $header))
{
	echo "Your mail sent success message";
}
else
{
	echo "Your error message.";
}

Maybe this would be better for you.

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#4 zjp

zjp
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 10 July 2006 - 07:05 AM

first,thank you for your help.
your code maybe use mail() ,but i want use socket,can you give me another one?

#5 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 10 July 2006 - 07:11 AM

what mail server are you using? The second one that I posted should work.

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users