Trying to email from ASP.NET

Results 1 to 3 of 3

Thread: Trying to email from ASP.NET

  1. #1
    Join Date
    Dec 1969

    Default Trying to email from ASP.NET

    I have written a small page that is supposed to email an excel spreadsheet when a button is clicked. The page works fine on my system, which is XP Pro. But when I copy it to the server, it fails. The server is a Windows 2003 SB Server which has Exchange Server 2003. I verified that the SMTP server is up and running. I am really stumper as to why it won&#039;t work on the server. There is no error. I just performed a Try/Catch and setup a label to let me know if it worked or not. Here is the code I am using, any help that could be provided would be appreciated.<BR><BR>Thanks,<BR><BR>Try<BR>Dim objMailMessage As Mail.MailMessage<BR>Dim objMailAttachment = New Mail.MailAttachment("c:TTE_Assignment_Billing.xls" )<BR><BR>objMailMessage = New Mail.MailMessage<BR>objMailMessage.From = hidden for security reasons<BR>objMailMessage.To = hidden for security reasons<BR>objMailMessage.Bcc = hidden for security reasons<BR>objMailMessage.Subject = "Your spreadsheet is attached to this email."<BR>objMailMessage.Body = "Please check the attachment for the spreadsheet."<BR>objMailMessage.Attachments.Add(ob jMailAttachment)<BR><BR><BR>Mail.SmtpMail.Send(obj MailMessage)<BR><BR>lblEmail.Text = "The email has been sent successfully!"<BR><BR>Catch ex As Exception<BR><BR>lblEmail.Text = "The email was not sent successfully!"

  2. #2
    Join Date
    Dec 1969

    Default Few things to check

    1) Is the xls file in the same exact location?<BR><BR>2) Does the ASPNET user (on Windows 2003 its the MACHINE ACCOUNT user) have permission on the c: root (HORRIBLE idea to allow so btw)<BR><BR>3) Have you tried to send just a plain ol email through SMTP to make sure SMTP is properly functioning?<BR><BR>4) More help (basically "all you need to know about System.Web.Mail) is at:<BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: Few things to check

    I had faced a similar problem before, which was solved when I specified the name of the smtp server.<BR><BR><BR> SmtpMail.SmtpServer = "smtp server/exchange server name"<BR> SmtpMail.Send(objMail)<BR><BR>Try this, and it should work.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts