?
Solved

Cannot send email from asp.net

Posted on 2004-11-10
6
Medium Priority
?
226 Views
Last Modified: 2008-02-26
I'm trying to send email from an ASP.NET app and I can do it when I run the app from my desktop machine but it does nothing when I deploy to the production server.  I'm running the Merak Email server on production.  My code is:

          Try
                Dim EmailMsg As MailMessage = New MailMessage

                With EmailMsg
                    .To = sTo
                    .Cc = sFrom
                    .Bcc = sCC
                    .From = sFrom

                    .Subject = sSubject
                    .Body = sBody
                    .Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 366)
                    '.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", 2)
                    .Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
                    .Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "myUsername")
                    .Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "myPassword")

                End With
                SmtpMail.SmtpServer = sEmailServer
                SmtpMail.Send(EmailMsg)
            Catch
                sError = Err.Description
            End Try

I don't get an email message nor any entry in the SMTP server log that indicates it attempted to send a message.  Obviously there is something on my dev machine that is missing from production but I don't know what.

0
Comment
Question by:mdebeer
  • 3
  • 2
6 Comments
 
LVL 18

Assisted Solution

by:tusharashah
tusharashah earned 750 total points
ID: 12551314
Are you printing sError message anywhere? Check out if you're getting any error in there.

The onlything that you might be checking for is your sEmailServer. Make sure it's configured right and myUserName have proper access on that server.

-tushar
0
 

Author Comment

by:mdebeer
ID: 12552045
Not printing error message but I will do that.

The code runs find when I run it on my desktop so I know that the username, password, etc. are correct.  It's the same code and it successfully sends an email from that email server if I run it on my desktop.  It just won't run when deployed to the server.
0
 
LVL 25

Accepted Solution

by:
nauman_ahmed earned 750 total points
ID: 12552148
ASP.NET needs that the relay option for the local server is set to permitted. Make sure that in the SMTP server properties, you have given rights to localhost (127.0.0.1) to relay mails.

Best, Nauman.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mdebeer
ID: 12554177
I checked the relay option and it was set to allow localhost.  After further investigation it looks like it was a problem with cookies that was preventing the app from ever firing the email code when running on the production box.  Once I fixed the cookie problem the email functioned as expected.

Thanks for your help.
0
 

Author Comment

by:mdebeer
ID: 12554215
I want to give you guys some points for your responses but the full 500 probably is too much since I resolved it on my own.  Don't know how to assign split and assign less than 500.  Do you guys?
0
 
LVL 18

Expert Comment

by:tusharashah
ID: 12554272
Post a request Community Support asking for a moderator to perform that task for you.
   http://www.experts-exchange.com/Community_Support/

-tushar

Points are not important, but the Grade is :)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month16 days, 11 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question