User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion

Reply
Thread Tools Display Modes
Unread 28 Oct 2002, 15:00   #1
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
E-mail: SMTP

I have two requests actually.

Firstly, I'm looking for an implementation of an SMTP client, a rather simple one. It's for my webserver thingy to report errors by E-mail. If any of you Linux people have an C implementation around please post/PM it .

Secondly I'd like to make an automated E-mail thingy for my Win2k server and use it in an ASP/PHP script (preferably ASP). Does anyone happen to know how I can do this. Preferably without any third party programs.

TY
__________________
"Yay"
Structural Integrity is offline   Reply With Quote
Unread 28 Oct 2002, 15:41   #2
CjC
Throwing Shapes
 
CjC's Avatar
 
Join Date: Apr 2000
Posts: 797
CjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant future
for (2) what you can do is use the CDO object.

Thus a basic message is:

Code:
set msg=server.createobject("CDONTS.Newmail")

strFrom="[email protected]"
strTo="[email protected]"
strSubj="Subject Line"
strBody="[Enter the body text here]"

msg.send strFrom,strTo,strSubj,strBody
(edit: added the "set" bit, sorry S.I.)

Now, on your IIS machine for the default SMTP server, all you need to do is configure it (By right clicking the default SMTP instance in IIS manager). Then go to the delivery tab and enter a "Smarthost" - a smart host is the smtp server on the internet you need to send the emails to.
__________________
Time is an Illusion, Lunchtime doubly so.

Last edited by CjC; 28 Oct 2002 at 18:26.
CjC is offline   Reply With Quote
Unread 28 Oct 2002, 17:30   #3
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
I found the smarthost field. Are there any "free" smarthosts around? If so, can you name a few?
If not, are there other ways of sending e-mails from my server?

It's not like I'm planning on sending bulk-mail, just a few automessages.
__________________
"Yay"
Structural Integrity is offline   Reply With Quote
Unread 28 Oct 2002, 17:33   #4
BesigedB
Darling
 
BesigedB's Avatar
 
Join Date: Dec 2000
Location: Edinburgh
Posts: 890
BesigedB is a glorious beacon of lightBesigedB is a glorious beacon of lightBesigedB is a glorious beacon of lightBesigedB is a glorious beacon of lightBesigedB is a glorious beacon of light
your isp's one
__________________
..
BesigedB is offline   Reply With Quote
Unread 28 Oct 2002, 17:40   #5
CjC
Throwing Shapes
 
CjC's Avatar
 
Join Date: Apr 2000
Posts: 797
CjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant future
Your ISP normally provides you one so you can send emails from outlook or whatever you happen to be using.

As for open-relay SMTP's well they are becoming rather sparse these days, obviously due to the spamming society out there.
__________________
Time is an Illusion, Lunchtime doubly so.
CjC is offline   Reply With Quote
Unread 28 Oct 2002, 18:21   #6
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
I copy-pasted your code, entered a few other mail addresses and got the following error:

Quote:
Error Type:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'msg'
/struct/index.asp, line 2
The line that fecks up:

Code:
msg=server.createobject("CDONTS.Newmail")
Could it be my version of ASP that doesn't recognise the object?

[edit]
Wait, I found it....
"msg" appears to be a reserved word in ASP...

Still.... I can't e-mail myself...
***looks further***
[/edit]
__________________
"Yay"
Structural Integrity is offline   Reply With Quote
Unread 28 Oct 2002, 18:25   #7
CjC
Throwing Shapes
 
CjC's Avatar
 
Join Date: Apr 2000
Posts: 797
CjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant futureCjC has a brilliant future
Agg, that should read:

Code:
Set msg=Server.CreateObject("CDONTS.NEWmail")
oops
__________________
Time is an Illusion, Lunchtime doubly so.
CjC is offline   Reply With Quote
Unread 28 Oct 2002, 18:40   #8
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
K... the script is fine, as it appears, but I get a nasty error from my SMTP server:

(Taken from the badmail folder in the mailroot)
Unable to deliver this message because the follow error was encountered: "This message is a delivery status notification that cannot be delivered.".

The mail (full header)
Quote:
From: postmaster@<MY COMP NAME>
To: [email protected]
Date: Mon, 28 Oct 2002 18:48:02 +0100
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="9B095B5ADSN=_01C27EA052B656860000000Bcp248812?b"
Message-ID: <hJquXee8S00000006@cp248812-b>
Subject: Delivery Status Notification (Failure)

This is a MIME-formatted message.
Portions of this message may be unreadable without a MIME-capable mail program.

--9B095B5ADSN=_01C27EA052B656860000000Bcp248812?b
Content-Type: text/plain; charset=unicode-1-1-utf-7

This is an automatically generated Delivery Status Notification.

Delivery to the following recipients failed.

[email protected]




--9B095B5ADSN=_01C27EA052B656860000000Bcp248812?b
Content-Type: message/delivery-status

Reporting-MTA: dns;cp248812-b
Received-From-MTA: dns;cp248812-b
Arrival-Date: Mon, 28 Oct 2002 18:47:58 +0100

Final-Recipient: rfc822;[email protected]
Action: failed
Status: 5.0.0

--9B095B5ADSN=_01C27EA052B656860000000Bcp248812?b
Content-Type: message/rfc822

Received: from mail pickup service by cp248812-b with Microsoft SMTPSVC;
Mon, 28 Oct 2002 18:47:58 +0100
From: <[email protected]>
To: <[email protected]>
Subject: subject
Date: Mon, 28 Oct 2002 18:47:58 +0100
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <CP248812-BPNv5m8EqL00000006@cp248812-b>
X-OriginalArrivalTime: 28 Oct 2002 17:47:58.0906 (UTC) FILETIME=[275299A0:01C27EAA]

text text text



--9B095B5ADSN=_01C27EA052B656860000000Bcp248812?b--
I find the first part a bit odd.... the name of the mail server of my ISP is "mail" (both pop3 and SMTP servers) so I filled that in as SmartHost, but I cannot find that name anywhere in the mail.
__________________
"Yay"
Structural Integrity is offline   Reply With Quote
Unread 28 Oct 2002, 18:56   #9
MT
/dev/zero
Retired Mod
 
MT's Avatar
 
Join Date: May 2000
Posts: 415
MT is an unknown quantity at this point
Slidey and ne are currently writing a complete email server in C : Slidey is doing the POP3 end, I'm doing the SMTP end.

Sending emails is really quite simple.
  • Locate the primary MX record for the host you wish to contact (ie [email protected], you would want the MX records of subhost.host.com)
  • Open a TCP connection on port 25 to the host specified in the MX record. If you cant 'get thru' to that host, try the next in line. Repeat until you run out of records, then quit.
  • Handshake and deliver the message (see subsection)
  • Terminate connection

SMTP is a very basic protocol. I'll just put down a few sample sessions here. CLIENT and SERVER ... you are client, the box you connect to is server.

Code:
S220 evans01.evansconsult.co.uk ESMTP Server (Microsoft Exchange Internet Mail Service 5.5.2448.0) ready
CHELO myhostname
S250 OK
MAIL FROM: [email protected]
S250 OK - mail from <[email protected]>
CRCPT TO: [email protected]
S250 OK - Recipient <[email protected]>
CDATA
S354 Send data.  End with CRLF.CRLF
Mail from: I am god <[email protected]>

HEH
How do you put CRLF.CRLF in a message without it quiting?
..

See?
.Every line that starts with a . has the . removed
.
S250 OK
CQUIT
S221 Closing Connection.
The form of email messages is VERY complex* - if you dont care, you neednt put any headers in, but this doesnt conform to the RFC..

That email came thru to Outlook as ...

Code:
Received: from myhostname (SYSTEMAX_XP [192.168.0.6]) by evans01.evansconsult.co.uk with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2448.0)
	id SMCKJADJ; Mon, 28 Oct 2002 17:49:39 -0000
Mail from: I am god <[email protected]>

HEH
How do you put CRLF.CRLF in a message without it quiting?
.

See?
.Every line that starts with a . has the . removed
**

The relevant RFC's are RFC822 for the message (the bit that goes in the DATA command) and RFC821 for SMTP itself. You can add a 2 (RFC2821, RFC2822) to the front of both of those RFC's for the most recent versions, technically these RFC's are obsoleted, but they are only superceded by more complex versopns; sending an email will still work with those simple bits.





*I'm lying. Its very easy, its just very long :/

** As you can see, Microsoft Exchange 5.5 completely ignores section 4.5.2 of RFC821 ..
Quote:
2. When a line of mail text is received by the receiver-SMTP
it checks the line. If the line is composed of a single
period it is the end of mail. If the first character is a
period and there are other characters on the line, the first
character is deleted.
__________________
#linux : Home of Genius

<idimmu> ok i was chained to a desk with this oriental dude
MT is offline   Reply With Quote
Unread 28 Oct 2002, 19:04   #10
MT
/dev/zero
Retired Mod
 
MT's Avatar
 
Join Date: May 2000
Posts: 415
MT is an unknown quantity at this point
no problems here ...

Code:
tgevan@csc524 [06:15pm] '~'
> $ host -t mx hotmail.com
hotmail.com mail is handled (pri=5) by mx1.hotmail.com
hotmail.com mail is handled (pri=5) by mx2.hotmail.com
hotmail.com mail is handled (pri=5) by mx3.hotmail.com
hotmail.com mail is handled (pri=5) by mx4.hotmail.com
tgevan@csc524 [06:16pm] '~'
> $ telnet mx1.hotmail.com 25
Trying 65.54.252.99...
Connected to mx1.hotmail.com.
Escape character is '^]'.
220 mc5-f2.law1.hotmail.com Microsoft ESMTP MAIL Service, Version: 5.0.2195.4905 ready at  Mon, 28 Oct 2002 10:16:20 -0800
HELO csc524.essex.ac.uk
250 mc5-f2.law1.hotmail.com Hello [155.245.22.88]
MAIL FROM: [email protected]
250 [email protected] OK
RCPT TO: [email protected]
250 [email protected]
DATA
354 Start mail input; end with <CRLF>.<CRLF>
weeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
.
250 <[email protected]> Queued mail for delivery
QUIT
221 mc5-f2.law1.hotmail.com Service closing transmission channel
Connection closed by foreign host.
__________________
#linux : Home of Genius

<idimmu> ok i was chained to a desk with this oriental dude
MT is offline   Reply With Quote
Unread 28 Oct 2002, 19:06   #11
MT
/dev/zero
Retired Mod
 
MT's Avatar
 
Join Date: May 2000
Posts: 415
MT is an unknown quantity at this point
Have you cleverly forgotten to setup an SMTP server to relay for you?
__________________
#linux : Home of Genius

<idimmu> ok i was chained to a desk with this oriental dude
MT is offline   Reply With Quote
Unread 28 Oct 2002, 19:21   #12
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
Quote:
Originally posted by MT
Have you cleverly forgotten to setup an SMTP server to relay for you?
**raises left eyebrow**

I have my ISP SMTP server and my own win2k SMTP service where I filled in my ISP's server as SmartHost....
__________________
"Yay"
Structural Integrity is offline   Reply With Quote
Unread 28 Oct 2002, 19:25   #13
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
The problem is solved....

I told you that the servers name is "mail" in my ISP network....

Now, my ISP DNS seems to be down since yesterday, and I'm using the DNS from another ISP.
Because I filled in "mail" as my SmartHost it could not retrieve the name. I changed it into "mail.home.nl" and now the other DNS can resolve it and I can send mails!!!

\o/
__________________
"Yay"
Structural Integrity is offline   Reply With Quote
Unread 29 Oct 2002, 05:34   #14
W
Gubbish
 
Join Date: Sep 2000
Location: #FoW
Posts: 2,323
W is a jewel in the roughW is a jewel in the roughW is a jewel in the rough
Damn, I saw the thread, and knew I could help, and there MT got there ahead of me :/

BTW, the "mail" host is just a local dns entry; it does not resolve (or resolves to the wrong computer) if you do not use your isp's DNS
__________________
Gubble gubble gubble gubble
W is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 15:15.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018