zjp Posted July 8, 2006 Share Posted July 8, 2006 who can give me the code?thanks Quote Link to comment https://forums.phpfreaks.com/topic/14013-how-to-send-mail-use-socket/ Share on other sites More sharing options...
tomfmason Posted July 8, 2006 Share Posted July 8, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/14013-how-to-send-mail-use-socket/#findComment-54712 Share on other sites More sharing options...
tomfmason Posted July 8, 2006 Share Posted July 8, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/14013-how-to-send-mail-use-socket/#findComment-54713 Share on other sites More sharing options...
zjp Posted July 10, 2006 Author Share Posted July 10, 2006 first,thank you for your help.your code maybe use mail() ,but i want use socket,can you give me another one? Quote Link to comment https://forums.phpfreaks.com/topic/14013-how-to-send-mail-use-socket/#findComment-55420 Share on other sites More sharing options...
tomfmason Posted July 10, 2006 Share Posted July 10, 2006 what mail server are you using? The second one that I posted should work. Quote Link to comment https://forums.phpfreaks.com/topic/14013-how-to-send-mail-use-socket/#findComment-55421 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.