CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
How do you determine SMTP server?

 



wayne1975
Novice

Sep 2, 2002, 10:55 AM

Post #1 of 14 (3964 views)
How do you determine SMTP server? Can't Post

I would like to send emails using Perl for a virtual cards script. I do not have sendmail or a server to send out emails. I have to use a program called Blat. But, I can only send out emails if I know the SMTP of the recipient.

So, how do you determine the SMTP for an email address?

Any help and examples would be greatly appreciated. Thanks.

Wayne


thebitch
User

Sep 2, 2002, 10:56 PM

Post #2 of 14 (3959 views)
Re: [wayne1975] How do you determine SMTP server? [In reply to] Can't Post

SMTP ~ Simple Mail Transfer Protocol

Protocol != attribute of a recipient

There is no way to do it.
You can guess, and it'd work most of the time,
but there is no foolproof way.

SMTP runs on port 25 most of the time,
so try that users's domain (stuff after @)
on port 25

sometimes a mail.domain might be in order,
but otherwise you're out of luck

you can always find an anonymous SMTP
server which will let you send your mail


wayne1975
Novice

Sep 2, 2002, 11:33 PM

Post #3 of 14 (3958 views)
Re: [thebitch] How do you determine SMTP server? [In reply to] Can't Post

I wouldn't say "never" for anything regarding programming. There is usually a solution somewhere.

I think it would be very bad to try and guess at the user's SMTP... it needs to work 100% of the time... why should some people get messages and some not?

I am new to using the mail program Blat, and I really got stuck when I didn't have an SMTP to use. The script was working fine for a while... then, the SMTP I was using didn't allow me to send the messages. When I asked in the Blat Help Yahoo group regarding the lookup of an SMTP, someone mentioned looking at http://search.cpan.org for modules (Net::DNS and Net::SMTP), and they said it would be a very complicated process... so I didn't really want to with that solution.

I have everything coded in Perl, but I can also use ASP. I know how to call another Perl script within a Perl script, but how do you call Web pages or ASP within a Perl script? I can use CDNOTS to send out mail, so I could do the majority of everything in Perl and send out the mail using ASP if there's a way to call or refresh to an ASP page (using Perl not a refresh tag or something like that). Please let me know if you have any examples on what I am looking for or if you have any suggestions. Thanks.

Wayne


thebitch
User

Sep 3, 2002, 12:16 AM

Post #4 of 14 (3957 views)
Re: [wayne1975] How do you determine SMTP server? [In reply to] Can't Post


In Reply To
I wouldn't say "never" for anything regarding programming. There is usually a solution somewhere.


I would. Excluding solutions by design creates this condition.


In Reply To
... why should some people get messages and some not?


Because you insist upon something called BLAT
and refuse to run a mail server.


In Reply To
... CPAN ... so I didn't really want to with that solution.


Exploit CPAN cause that's what it's there for.
Refuse to use CPAN and suffer, it's as simple as that.

Email::Valid
"This module determines whether an email address is well-formed, and optionally, whether a mail host exists for the domain. "


In Reply To
... but how do you call Web pages ...


you read PERLFAQ, there is 9 big pages.
There is also the ActivePerl FAQ , which covers additional
topics.

Since "web pages" are just that, "web pages",
and aren't "programs" on your system,
you can't "call" them
( you can, but you can also call me thebitch,
but it won't do you any good, cause i'm not a program on your system )

if you read the faq, it'll tell you you need LWP


wayne1975
Novice

Sep 3, 2002, 12:33 AM

Post #5 of 14 (3955 views)
Re: [thebitch] How do you determine SMTP server? [In reply to] Can't Post

Very unhelpful. Someone other than thebitch please reply with help or suggestions. Thanks.

Wayne


davorg
Thaumaturge / Moderator

Sep 3, 2002, 12:51 AM

Post #6 of 14 (3954 views)
Re: [wayne1975] How do you determine SMTP server? [In reply to] Can't Post

I think you're looking at this the wrong way. You don't need to find the recipient's SMTP server, you just need to find _an_ SMTP server that you can use. Once you've passed the mail onto an SMTP server, then that will pass it on to the next one - and so on until it reaches your recipient.

Surely whoever gives you connectivity to the internet will be running and SMTP server that you can use. You should just find out where that is.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


wayne1975
Novice

Sep 3, 2002, 1:39 AM

Post #7 of 14 (3952 views)
Re: [davorg] How do you determine SMTP server? [In reply to] Can't Post

Hi Dave,

I do not have any control of the server my site is at, and my host only installed Blat... probably because it is an NT server and they have ASP related email programs. The script I have is all Perl, and I spent quite a long time modifying the original to fit in with my Web site. So, I do not want to redo the entire thing in ASP.

If my domain was at www.foo.com and my mail server was at mail.foo.com, I can not send out emails to users outside of the foo.com domain. I am not sure why, but I will complain to the host later on today. Even using regular email clients like Outlook, there is that same problem. On the host's help page, they tell you to use your Internet service provider's SMTP. So, I will have to investigate the mail server problem with my domain.

I had tried using my ISP's SMTP, but I still error when the domain is different than the domain of the recipient... maybe there is a relay problem with how the host setup Blat... I will ask them about this, also.

So if the script was named "myscript.cgi", there is no way to call the script and then end up on some other page like "anotherpage.asp" after the script is done processing (without using a refresh meta tag on the output page)?... meaning I will always end up on myscript.cgi after everything is finished?

Thanks again for your help Dave.

Wayne


thebitch
User

Sep 3, 2002, 1:48 AM

Post #8 of 14 (3950 views)
Re: [wayne1975] How do you determine SMTP server? [In reply to] Can't Post

How so? ( i answered practically all your questions)

Do you have a different definition of helpful?


Paul
Enthusiast

Sep 3, 2002, 2:17 AM

Post #9 of 14 (3948 views)
Re: [wayne1975] How do you determine SMTP server? [In reply to] Can't Post

You have the logic wrong as dave mentioned, blat.exe doesn't need the smtp server of the receipient, it needs the name of an smtp server that you have relay access too.


So basically you need to find an smtp server.


wayne1975
Novice

Sep 3, 2002, 8:10 PM

Post #10 of 14 (3939 views)
Re: [RedRum] How do you determine SMTP server? [In reply to] Can't Post

Thanks RedRum. I did get the gist of what Dave was saying, but I was trying to see if there was a way to send to e-mail address authenticated by the SMTP server (only known to)... that's why I mentioned tracing each SMTP. The original problem I was having with Blat was that only e-mail addresses know to the SMTP servers worked. But, my script now works again: http://www.wgpkr.com/GPK/ECards/ After my call to the host, they seemed to fix the mail server problem. And, I updated the script to use my e-mail server and information.

I felt thebitch's responses were confrontational and not helpful... most of everything said was contradictory to what I said I wanted to do, could do, or was using in my script. If I need help with a script or have a question, thebitch is a person I do not want help from.

I do still have the question about ending up on a non-cgi/pl page when the script is finished running... like doing a refresh or redirect (not HTML meta tag refresh). Is this possible in Perl? I've used that sort of thing with ASP many times and thought something similar might be built into Perl. Let me know. Thanks.

Wayne


davorg
Thaumaturge / Moderator

Sep 4, 2002, 12:50 AM

Post #11 of 14 (3937 views)
Re: [wayne1975] How do you determine SMTP server? [In reply to] Can't Post


In Reply To
I do still have the question about ending up on a non-cgi/pl page when the script is finished running... like doing a refresh or redirect (not HTML meta tag refresh). Is this possible in Perl? I've used that sort of thing with ASP many times and thought something similar might be built into Perl.


It's not a Perl issue, but an HTTP issue. You can return a "redirect" (403) response code together with a "Location:" header to get the client to redirect to another page.

The easiest way to do that in Perl is to use the "redirect" function from CGI.pm.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


wayne1975
Novice

Sep 4, 2002, 10:11 AM

Post #12 of 14 (3935 views)
Re: [davorg] How do you determine SMTP server? [In reply to] Can't Post

Thanks Dave. This code seemed to do exactly what I was looking to do:
----------
#!/usr/local/bin/perl

use CGI qw(:standard);

print redirect('http://www.mysite.com/An_ASP_Page.asp');
----------
And what I like is that there's no requirement for JavaScript to be enabled in order to do the redirection. Thanks again.

Wayne


Paul
Enthusiast

Sep 4, 2002, 11:18 AM

Post #13 of 14 (3931 views)
Re: [wayne1975] How do you determine SMTP server? [In reply to] Can't Post

Use:

use CGI qw/:redirect/;

....it doesn't import as much.


(This post was edited by RedRum on Sep 4, 2002, 11:20 AM)


wayne1975
Novice

Sep 4, 2002, 11:59 AM

Post #14 of 14 (3928 views)
Re: [RedRum] How do you determine SMTP server? [In reply to] Can't Post

Cool. Thanks for the tip RedRum.

Wayne

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives