Forum Moderators: coopster & phranque

Message Too Old, No Replies

Form Mail : smtp server name

what standard values are defined?

         

kaled

3:24 pm on Jun 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've written my own form mail script and plan to publish it. Everything is working fine on my system but I'd like to know what standard server names can be used in the following function
$smtp = Net::SMTP->new($mailserver, Timeout => $timeout, Debug => 1);

I'm using 'smtp.mydomain.com' - that's ok.
'localhost' also appears to work.
'mailhost' does not appear to work.
I found both these values used in examples.

Also, is my syntax correct with respect to setting the Timeout?

Thanks,

Kaled.

volatilegx

7:59 pm on Jul 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The server names will vary from server to server. Localhost, will of course access the same machine on which the script is running. Any other server name will access a remote domain.

The name of the server doesn't matter too much, assuming it is the correct name for the machine you are trying to reach. What really matters is that the module is attempting to access an SMTP server through the correct port (usually 25, I believe). I assume the Net::SMTP module handles that for you.

One other thing you might want to code for is that some servers require authentication in order to use SMTP. To do this, you'd use the auth method. Unfortunately, I wasn't able to find any syntax examples for this method, but maybe it looks something like this:

$smtp = Net::SMTP->new($mailserver, Timeout => $timeout, Debug => 1);
$auth = $smtp->Auth($userID,$password);

kaled

11:23 pm on Jul 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, this authorisation issue is worrying. My own server requires it (unless I've just received emails) however, I have never had a problem testing the script. Eventually, I decided that authorisation must be waived when called locally - that makes sense but I would sure like a definitive answer. Mostly I've tested using local mailboxes, but I guess I should do some more testing with remote mailboxes.

Fingers crossed,

Kaled.

vrtlw

11:32 pm on Jul 5, 2004 (gmt 0)

10+ Year Member



You should check out the Mail::Sender module, the features seem to me to be fit for your needs. I have never installed it (or looked at the install notes) but you may be able to include it in your distribution without too much effort.

kaled

12:19 am on Jul 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Problems, problems, problems... just got it to fail. So I tried smtp->auth on my pc and the perl interpreter just stopped. However, hopefully, it will work on my server, but it's time for bed.

Just when you think something is finished, you find it isn't - typical.

Thanks for suggestions,

Kaled.