PDA

View Full Version : Smtp



InNeedofHelp
02-25-2006, 03:18 PM
Hey, I got a couple questions about setting up your system to do Simple Mail Transfer Protocol functions.

- Do I need to find my SMTP address to send mail even if I'm just using the mail function as a test to learn PHP?

- Can I use an SMTP address from a different computer in my house that is connected to mine through wireless internet?

Sorry if my question's are a little vague.
Thanks in advance.

Twey
02-25-2006, 03:59 PM
- Do I need to find my SMTP address to send mail even if I'm just using the mail function as a test to learn PHP?There are two ways to go about it: using your own SMTP server, or using a remote SMTP server. On Windows, the usual behaviour is to use a remote SMTP server. In this case, you need to connect to it to send any sort of mail, testing or not.
- Can I use an SMTP address from a different computer in my house that is connected to mine through wireless internet?An SMTP "address" isn't "on" anything. When you send mail to user@example.com, your mail client (usually) connects to the SMTP server at example.com and sends the data, addressed to user. As such, it doesn't matter where you send the request from.
You probably ought to read RFC 821 (http://www.ietf.org/rfc/rfc0821.txt).

InNeedofHelp
02-25-2006, 04:15 PM
Well, I have a book on PHP, and according to my book, I'm supposed to find an SMTP address on my computer, then go into php.ini and modify the [Mail] portion to work with my SMTP address to then send messages via PHP Mail command. However, I use Yahoo's E-Mail service, so I havn't a clue what my SMTP Address is on my computer. All I really want to know is if modifying the [Mail] part of php.ini is the only way that i can send test messages via PHP Mail command.

Twey
02-25-2006, 05:07 PM
Well, I have a book on PHP, and according to my book, I'm supposed to find an SMTP address on my computer, then go into php.ini and modify the [Mail] portion to work with my SMTP address to then send messages via PHP Mail command.It probably means your email address.
I use Yahoo's E-Mail service, so I havn't a clue what my SMTP Address is on my computer.Yahoo! may use SMTP. Try using your Yahoo! address to send email. If you can't, I suggest you get a free SMTP email account (http://www.iopus.com/guides/bestpopsmtp.htm).
All I really want to know is if modifying the [Mail] part of php.ini is the only way that i can send test messages via PHP Mail command.Probably. You might be able to find and install a Windows SMTP server, but I've never seen one.

InNeedofHelp
02-25-2006, 05:33 PM
Allright, sounds good.

Thanks Twey. :)

InNeedofHelp
02-25-2006, 06:08 PM
Wait, one thing. Are you saying my book is implying to do this:


[mail function]
; For Win32 only.
SMTP = myemailaddress@yahoo.com?

Twey
02-25-2006, 06:43 PM
No, "SMTP" needs to be set to the address of the SMTP server: in this case, smtp.yahoo.com (yes, I checked it, it does exist).

InNeedofHelp
02-25-2006, 06:47 PM
OHHH OK!

I get it now, allright.

So can I just use smtp.yahoo.com ?
Or do i have to go and register a SMTP address at yahoo?

Twey
02-25-2006, 06:52 PM
do i have to go and register a SMTP address at yahoo?No, I presume Yahoo!'s standard addresses use SMTP to send email. Presuming you have a @yahoo.com address, smtp.yahoo.com ought to do you fine.

InNeedofHelp
02-25-2006, 07:52 PM
Wonderful. :D

Thanks so much.

marcusth
10-08-2007, 03:13 PM
hey,

i'm facing sor of the same problem as InNeedOfHelp, i'm doing a web project using my laptop at home. I need to test it which include sending of mail to user. However, i want to use a remote smtp server to deal with forwarding my mail to hotmail or yahoo.

i change my php.ini into:


[mail function]
; For Win32 only.
SMTP = smtp.net (smtp server i wan to make use of)
smtp_port = 25


; For Win32 only.
;sendmail_from = mymail@hotmail.com

what else did i lack of, assuming my coding to send a simple mail is error-free??

tnx alot in advance

Twey
10-08-2007, 05:11 PM
what else did i lack of, assuming my coding to send a simple mail is error-free??You forgot to uncomment the sendmail_from line.

thetestingsite
10-08-2007, 07:32 PM
You might be able to find and install a Windows SMTP server, but I've never seen one.


hMailServer (http://www.hmailserver.com) is a free, fully functional mail server for Windows. Pretty simple to install and use.

Hope this helps.

marcusth
10-09-2007, 01:45 AM
oya, wad a silly mistakes i shall go try later.

hey testingsite, but i don wan to install any mail server in my laptop, i wanna use the smtp server which eventually i have to make use of in future.

So other den the php.ini file, is there any xtra codings needed??

marcusth
12-07-2007, 05:44 PM
I'm having a rather same scenerio here for weeks without getting a feasible solution, can any1 help me with this?? As i'm totally new to PHP, i tried many methods found online but got stuck at some stage e.g changing php.ini, using swiftmailer etc. So can any1 guide me along, assuming i jux installed my php and did nth to it...really apreciate it

You see, i'm currently working on a web application which involve sending emails to user. I'm using windowXP SP2, with apache installed incorporate with MySQL as my server. Rite now my code for sending the mail is :


<?php
require_once "Mail.php";

$from = "Sandra Sender <sender@example.com>";
$to = "Ramona Recipient <recipient@example.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

$host = "smtp.yahoo.com";
$username = "smtp_username";
$password = "smtp_password";

$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,'auth' => true,
'username' => $username,
'password' => $password));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
?>


As you can see, i'm trying to use yahoo as my external smtp mail server to help send my mail to my application end user.


Any guidance plss??? tnx alot