Please Help me to send Mails

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
minos_mks
Forum Commoner
Posts: 69
Joined: Thu Feb 04, 2010 1:58 am

Please Help me to send Mails

Post by minos_mks »

I need to know what i need to use the mail function successfully cause i got this massage and , thank you for your time
Attachments
smtp.jpg
smtp.jpg (138.84 KiB) Viewed 3680 times
User avatar
PHPHorizons
Forum Contributor
Posts: 175
Joined: Mon Sep 14, 2009 11:38 pm

Re: Please Help me to send Mails

Post by PHPHorizons »

Hello minos_mks,

You will need a mail server. Pegasus Mail/Mercury Mail comes to mind: http://www.pmail.com/
One problem you may have though is mail() does not allow authentication. And if you are planning on using Yahoo to send those mails out, I've had difficulty getting that to work.

You could purchase an SMTP Relay Service. Here's a google search on that: http://www.google.com/search?num=30&hl= ... y&gs_rfai=

Cheers
Phoenixheart
Forum Contributor
Posts: 123
Joined: Tue Nov 16, 2004 7:46 am
Contact:

Re: Please Help me to send Mails

Post by Phoenixheart »

As the error box shows, you need to populate proper SMTP settings in php.ini (either direct modification or using ini_set()).
As far as I remember you can try Gmail's SMTP.
minos_mks
Forum Commoner
Posts: 69
Joined: Thu Feb 04, 2010 1:58 am

Re: Please Help me to send Mails

Post by minos_mks »

thanx every body for your time but , i have already the smtp ( hotmail ) smtp.live.com but i don't know what i should do with it , if there is any chance if somebody have like a video or any lesson explain this issue step by step because i am confused , thanx a lot
internet-solution
Forum Contributor
Posts: 220
Joined: Thu May 27, 2010 6:27 am
Location: UK

Re: Please Help me to send Mails

Post by internet-solution »

Get SMTP srever settings (server name, port, user name, password) from hotmail and then use fsocopen() function. see an example here on my site
Last edited by internet-solution on Mon Jun 21, 2010 12:10 pm, edited 1 time in total.
minos_mks
Forum Commoner
Posts: 69
Joined: Thu Feb 04, 2010 1:58 am

Re: Please Help me to send Mails

Post by minos_mks »

thanx man for your time

but i did the same and just change my information like this :

Code: Select all

     $smtp_server = "smtp.mail.yahoo.com";
$mydomain = "any_text_here";


//get the following info from your mail server eg. au.yahoo.com

$port = 25; //SMTP PORT of mail.mymailserver.com
$username = "mina_mks2003@yahoo.com"; $password = "*********";


$sender = "mina_mks2003@yahoo.com";

/*
Most respectable mail servers will reject outgoing mail
if $sender e-mail address does not belong to $username
*/

$sender_name = "Mina"; //Any name you fancy


$recipient = "minos_saad@hotmail.com";
$subject = "the subject";
$content = "the message";

// SMTP connection

$handle = fsockopen($smtp_server,$port);
fputs($handle, "EHLO $mydomain\r\n");

// SMTP authorization
fputs($handle, "AUTH LOGIN\r\n");
fputs($handle, base64_encode($username)."\r\n");
fputs($handle, base64_encode($password)."\r\n");

// Send out the e-mail
fputs($handle, "MAIL FROM:$sender\r\n");
fputs($handle, "RCPT TO:$recipient\r\n");
fputs($handle, "DATA\r\n");
fputs($handle, "From: $sender_name<$sender>\r\n");

//you can use different e-maill address in above line, but most spam blockers will suspect this

fputs($handle, "To: $recipient\r\n");
fputs($handle, "Subject: $subject\r\n");
fputs($handle, "$content\r\n");
fputs($handle, ".\r\n");

//Don't ignore the period "." in line above. This indicates the end of your mail

// Close connection to SMTP server
fputs($handle, "QUIT\r\n");

and it gives me an error it said :

Warning: fsockopen() [function.fsockopen]: unable to connect to smtp.mail.yahoo.com:25 (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. ) in C:\wamp\www\Coptic_List\includes\admin_functions.php on line 112

Fatal error: Maximum execution time of 60 seconds exceeded in C:\wamp\www\Coptic_List\includes\admin_functions.php on line 112
Last edited by Benjamin on Fri Jun 18, 2010 9:56 pm, edited 1 time in total.
Reason: Added [syntax=php] tags.
internet-solution
Forum Contributor
Posts: 220
Joined: Thu May 27, 2010 6:27 am
Location: UK

Re: Please Help me to send Mails

Post by internet-solution »

Are you sure you are using the correct sptm server information? In you previous post you mentioned hotmail (smtp.live.com), why are you using yahoo in the script?

Do you have a Yahoo premium account? Yahoo pop / smtp connection is only available to premuim accounts.
minos_mks
Forum Commoner
Posts: 69
Joined: Thu Feb 04, 2010 1:58 am

Re: Please Help me to send Mails

Post by minos_mks »

i was just trying to use a different smtp server , but i didn't know that it's not free , i don't know now if the problem now only the smtp or maybe another problems , and what about if i need to change the smtp server inside the php.ini , thanx for your help
Post Reply