Jump to content

Archived

This topic is now archived and is closed to further replies.

zjp

how to send mail use socket

Recommended Posts

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

[code]$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';[/code]

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.

Share this post


Link to post
Share on other sites
or maybe you could try this

[code]$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.";
}[/code]

Maybe this would be better for you.

Share this post


Link to post
Share on other sites
first,thank you for your help.
your code maybe use mail() ,but i want use socket,can you give me another one?

Share this post


Link to post
Share on other sites
what mail server are you using? The second one that I posted should work.

Share this post


Link to post
Share on other sites

×

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.