🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
5 messages
5 total messages Started by Stefano Bonifazi Thu, 01 Jul 2004 21:11
Indy relaying and CC, BCC fields
#5658
Author: Stefano Bonifazi
Date: Thu, 01 Jul 2004 21:11
22 lines
2188 bytes
Hello Everybody!:)
 I'm working on a SMTP Client that send emails without the use of a local
SMTP server
 This works by extracting the domain part form the recipient email address,
then doing an MX lookup against a DNS server for that domain part, and
finally connecting directly to the SMTP server that the MX record point to,
to deliver the message.(Taken from the Indy Demo SMTPRelay of Allen O'Neill)
All works fine but when I insert email addresses in the CC or BCC fields
cause the program raises the following exception: " EIdProtocolReplyError
with message <username@otherdomain> recipient address rejected."
I used otherdomain cause I assumed I'm sending an email (in TO: field)  with
domain other than the ones in CC or BCC fields!
Shouldn't  the SMTP server (given to me by the DNS server) forward the
emails in CC and BCC fields to the proper servers??
Of course I can take only an email address from the CC  or BCC field at a
time then do an MX lookup against a DNS server for that domain part, and
finally connect directly to the SMTP server that the MX record point to, to
deliver the message, but I need the email to arrive with the correct header,
that is with the correct email addresses in the CC or BCC fields!!
Any workaround??
Thank You very much in advance!!
Stefano B.
Re: Indy relaying and CC, BCC fields
#5659
Author: Remy Lebeau (TeamB)
Date: Fri, 02 Jul 2004 00:09
50 lines
3043 bytes
"Stefano Bonifazi" <stefboombastic@libero.it> wrote in message
news:40e47e0f@newsgroups.borland.com...

> All works fine but when I insert email addresses in the CC
> or BCC fields cause the program raises the following exception:
> "EIdProtocolReplyError with message <username@otherdomain>
> recipient address rejected."

If you connect to a particular domain's SMTP server directly, you should not
be specifying any addresses that do not belong to that domain.

> I used otherdomain cause I assumed I'm sending an email
> (in TO: field)  with domain other than the ones in CC or BCC fields!

The CC and Bcc lists also contain recipient addresses.  All three fields are
used for delivering mail.  The server very well could reject addresses that
it does not know about or know how to reach.

> Shouldn't  the SMTP server (given to me by the DNS server)
> forward the emails in CC and BCC fields to the proper servers??

Not necessarily, no.

> Of course I can take only an email address from the CC  or BCC
> field at a time then do an MX lookup against a DNS server for
> that domain part, and finally connect directly to the SMTP server
> that the MX record point to, to deliver the message

Yes.

> but I need the email to arrive with the correct header, that
> is with the correct email addresses in the CC or BCC fields!!

That has nothing to do with it.  When a client connects to an SMTP server,
it has to specify the intended recipients *before* any of the actual message
data is then transmitted.  The client parses the message to extract the
appropriate To, Cc, and Bcc addresses and then tells the server which ones
to send to.  Whatever is contained in the message data itself is transmitted
as-is and is not parsed during transmission.  The server doesn't care what
is in the message data at all.

TIdSMTP was not really designed for handling relaying, though.  With that
said, please go to the "news.atozedsoftware.com" server and look in the
"atozedsoftware.indy.protocol.smtp" newsgroup.  I posted an example a month
ago in the "SMTP Message Delivery - Multiple Recipients" discussion thread
on this issue.


Gambit
Re: Indy relaying and CC, BCC fields
#5660
Author: Stefano Bonifazi
Date: Fri, 02 Jul 2004 08:55
74 lines
4116 bytes
Thank You very much once again Mr. Gambit!
 That discussion thread was very clear and interesting!!
But I'm not writing a server so I don't have a TIdSMTPServer.OnReceiveRaw
that can give me the full raw (including the correct header!) email ... I'm
writing a client ... so is there a way to send a copy of my email to a
single user (by using the relaying system) at a time but with the full
header without Indy SMTP parsing the CC and BCC headers and so clashing
against the SMTP server?
Or should I need to build a raw email by myself and send it by connecting to
the SMTP server (given by the DNS server) through a brutal TCP connection??
 Thank You again,
Best Regards
Stefano B.

"Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> ha scritto nel
messaggio news:40e4a7c0$1@newsgroups.borland.com...
>
> "Stefano Bonifazi" <stefboombastic@libero.it> wrote in message
> news:40e47e0f@newsgroups.borland.com...
>
> > All works fine but when I insert email addresses in the CC
> > or BCC fields cause the program raises the following exception:
> > "EIdProtocolReplyError with message <username@otherdomain>
> > recipient address rejected."
>
> If you connect to a particular domain's SMTP server directly, you should
not
> be specifying any addresses that do not belong to that domain.
>
> > I used otherdomain cause I assumed I'm sending an email
> > (in TO: field)  with domain other than the ones in CC or BCC fields!
>
> The CC and Bcc lists also contain recipient addresses.  All three fields
are
> used for delivering mail.  The server very well could reject addresses
that
> it does not know about or know how to reach.
>
> > Shouldn't  the SMTP server (given to me by the DNS server)
> > forward the emails in CC and BCC fields to the proper servers??
>
> Not necessarily, no.
>
> > Of course I can take only an email address from the CC  or BCC
> > field at a time then do an MX lookup against a DNS server for
> > that domain part, and finally connect directly to the SMTP server
> > that the MX record point to, to deliver the message
>
> Yes.
>
> > but I need the email to arrive with the correct header, that
> > is with the correct email addresses in the CC or BCC fields!!
>
> That has nothing to do with it.  When a client connects to an SMTP server,
> it has to specify the intended recipients *before* any of the actual
message
> data is then transmitted.  The client parses the message to extract the
> appropriate To, Cc, and Bcc addresses and then tells the server which ones
> to send to.  Whatever is contained in the message data itself is
transmitted
> as-is and is not parsed during transmission.  The server doesn't care what
> is in the message data at all.
>
> TIdSMTP was not really designed for handling relaying, though.  With that
> said, please go to the "news.atozedsoftware.com" server and look in the
> "atozedsoftware.indy.protocol.smtp" newsgroup.  I posted an example a
month
> ago in the "SMTP Message Delivery - Multiple Recipients" discussion thread
> on this issue.
>
>
> Gambit
>
>
Re: Indy relaying and CC, BCC fields
#5664
Author: Remy Lebeau (TeamB)
Date: Fri, 02 Jul 2004 18:07
24 lines
1941 bytes
"Stefano Bonifazi" <stefboombastic@libero.it> wrote in message
news:40e52303@newsgroups.borland.com...

> is there a way to send a copy of my email to a single user (by
> using the relaying system) at a time but with the full header without
> Indy SMTP parsing the CC and BCC headers and so clashing
> against the SMTP server?

TIdSMTP does not support that.  It always uses the full message headers when
telling the SMTP server what to do.  Thus any CC and BCC entries will be
processed.  For what you are asking, you will just have to implement the
SMTP protocol manually.  Then you have full control over what is transmitted
to the server.

> Or should I need to build a raw email by myself and send it
> by connecting to the SMTP server (given by the DNS server)
> through a brutal TCP connection??

Yes, and the discussion I directed you to earlier had an example of exactly
that.  Please look at the RelayMessage() function in my example code.


Gambit
Re: Indy relaying and CC, BCC fields
#5665
Author: Stefano Bonifazi
Date: Fri, 02 Jul 2004 20:01
38 lines
2372 bytes
Thank You Mr. Gambit
 I don't know how many times I thanked You far now, You're a living bible
for young developers...
I wish You the best luck!!
Best, sincere regards!
Stefano B.

"Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> ha scritto nel
messaggio news:40e5a451$1@newsgroups.borland.com...
>
> "Stefano Bonifazi" <stefboombastic@libero.it> wrote in message
> news:40e52303@newsgroups.borland.com...
>
> > is there a way to send a copy of my email to a single user (by
> > using the relaying system) at a time but with the full header without
> > Indy SMTP parsing the CC and BCC headers and so clashing
> > against the SMTP server?
>
> TIdSMTP does not support that.  It always uses the full message headers
when
> telling the SMTP server what to do.  Thus any CC and BCC entries will be
> processed.  For what you are asking, you will just have to implement the
> SMTP protocol manually.  Then you have full control over what is
transmitted
> to the server.
>
> > Or should I need to build a raw email by myself and send it
> > by connecting to the SMTP server (given by the DNS server)
> > through a brutal TCP connection??
>
> Yes, and the discussion I directed you to earlier had an example of
exactly
> that.  Please look at the RelayMessage() function in my example code.
>
>
> Gambit
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads