Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can't send email

Status
Not open for further replies.

gib99

Programmer
Mar 23, 2012
51
0
0
CA
Hello,

I've got an application in which I'm trying to send email and it won't let me for some reason. Here is my code:

Code:
            try
            {
                MailMessage message = new MailMessage(sentFrom, sendTo, subject, body);
                SmtpClient client = new SmtpClient(smtpServer);
                client.Send(message);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }

The problem is that this code works on my local machine when I use my smtp server but when I put it on someone else's machine, it doesn't work. I get various error messages depending on smptServer and on the delivery method.

For example, if I have no delivery method, and I run this on my local machine but using the other person's smtp server, then I get the message:

"Service not available, closing transmission channel. The server response was: 4.3.2 Service not available, closing transmission channel"

If I include the line client.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis right before I send, I get:

"Cannot get IIS pickup directory."

If I replace that line with SmtpDeliveryMethod.SpecifiedPickupDirectory, I get:

"Only absolute directories are allowed for pickup directory."

If I replace that line with SmtpDeliveryMethod.Network, I get the "service not available" message again.

This is all if I run it on my local machine using the other person's smtp server. I haven't been able to test it on their machine with anything other than my own smtp server, but I know that none of the delivery methods work on their machine either. I have yet to try it on their machine with their smtp server with or without delivery methods (this will have to wait until they get back after the weekend).

Can anyone see the problem? Do you think it's just a matter of using their smtp server on their machine (without a delivery method)?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top