Link to home
Start Free TrialLog in
Avatar of craskin
craskinFlag for United States of America

asked on

SMTP problems

i'm trying to send mail to email address outside of the domain and i'm using the System.Net.Mail objects (not system.web). at first, i just tried a straight up send using the address of my exchange server as the smtp host, but i got relay errors for any addresses that were outside the domain. so i found somewhere that i could use SmtpDeliveryMethod.PickupDirectoryFromIis to get around this problem, but then i got Cannot get IIS pickup directory. so i figured it was because my exchange server did not have the smtp in IIS (it's in exchange and it's separate). so i installed smtp on the web host and configured it with the proper permissions, but now the emails just don't get sent and i don't get any errors.

Dim objMail As New MailMessage()
        objMail.From = New MailAddress("address@internaldomain.com")
        objMail.To.Add("address@internaldomain.com")
        objMail.CC.Add("address@externaldomain.com")

        objMail.Subject = "This is an email"
        objMail.Body = "this is a sample body with html in it. <b>This is bold</b> <font color=#336699>This is blue</font>"
        objMail.IsBodyHtml = True

        Dim smtp As New SmtpClient("192.168.1.8") 'the localhost
        smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis
        smtp.Send(objMail)
Avatar of craskin
craskin
Flag of United States of America image

ASKER

ah. i just found out that the external address did work, but the email to the internal one did not. that's even weirder. and now that the smtp is added to the localhost, when i switched the smtp server back to the exchange server, it delivered to the outside, but not the inside.
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of craskin

ASKER

no, do i setup an alias domain or a remote domain? right now, the local smtp just has

servername.domain.com Local (Default)
some long Guid.domain.com Local (Normal)

in the domain list.