Amir Shitrit said:
How can I tell the SmtpMail class to send mail that will not end in the spam
folder of the destination mailbox?
Currently, every e-mail message that I send ends up in the span/junk folder
if at all (in most of the times the message is rejected, and I have no idea
why).
Thanks in advance.
Hi,
I don't think this is related to SmtpMail class, rather to junk mail filter
configuration. However, few notes:
Most common reason for SMTP server to reject incoming email is:
a) relaying (mail destination mailbox must be on local server). You cannot
connect to arbitrary smtp server and request delivery. You'll have to
resolve MX (mailer exchange) record and deliver to that SMTP server. For
example, if you wont to deliver to yahoo.com, you have to connect to
mx1.mail.yahoo.com (mx2.mail.yahoo.com or other alternative server). This
will depend on your network setup and server you use. If you use local smtp
server, it has to be configured to allow relaying (then you don't have to
resolve MX records yourself, server will do that for you). If you use your
internet provider smtp server, provider will have it's own rules whether to
enable relaying or not (probalby not).
b) unspecified senders address (from field)
c) unresolvable domain (sent in HELO field as part of SMTP protocol)
For spam, it is local to the recipient configuration what will be reported
as spam. Most common filter is difference between "to" address field and
"rcpt to" sent to the server during mail sending.
I suggest you check smtp error codes sent during sending of email (use
network protocol analyzer if neccessary, ethereal is free) and check RFC's
on the internet with description of SMTP protocol.
HTH,
Goran