Showing posts with label users. Show all posts
Showing posts with label users. Show all posts

Monday, March 26, 2012

System.Net.Mail Address Book Access

I would like to allow our users a chance to select a MailMessage.To
destination if they want to before the email is sent. Is there a way to popu
p
the address book from OutLook? At this point, I'm assuming I'll need to use
automation to add this function.
Thanks, Stew"Stew" <Stew@.discussions.microsoft.com> wrote in message
news:682A09C4-6DE6-46AD-A04C-932011F73219@.microsoft.com...

>I would like to allow our users a chance to select a MailMessage.To
> destination if they want to before the email is sent. Is there a way to
> popup
> the address book from OutLook? At this point, I'm assuming I'll need to
> use
> automation to add this function.
Slightly curious...
Assuming this is a corporate intranet site, chances are addresses would
normally be stored in your mail server (e.g. the GAL in Exchange Server), so
you fetch them from there...
Obviously, you wouldn't even contemplate doing something like this on a
public website because of the security implications, and you'd have no way
of knowing if Outlook was installed anyway...
Can you describe your environment a bit more...?
http://www.markrae.net
yes, sorry it is an intranet site.
"Stew" <Stew@.discussions.microsoft.com> wrote in message
news:D4ED302E-5818-4F6A-8FA9-2D63883D3010@.microsoft.com...

> yes, sorry it is an intranet site.
OK, so presumably you have a network mail server to which everybody's local
Outlook connects and which contains the global set of email addresses...?
http://www.markrae.net

System.Net.Mail Address Book Access

I would like to allow our users a chance to select a MailMessage.To
destination if they want to before the email is sent. Is there a way to popup
the address book from OutLook? At this point, I'm assuming I'll need to use
automation to add this function.

Thanks, Stew"Stew" <Stew@.discussions.microsoft.comwrote in message
news:682A09C4-6DE6-46AD-A04C-932011F73219@.microsoft.com...

Quote:

Originally Posted by

>I would like to allow our users a chance to select a MailMessage.To
destination if they want to before the email is sent. Is there a way to
popup
the address book from OutLook? At this point, I'm assuming I'll need to
use
automation to add this function.


Slightly curious...

Assuming this is a corporate intranet site, chances are addresses would
normally be stored in your mail server (e.g. the GAL in Exchange Server), so
you fetch them from there...

Obviously, you wouldn't even contemplate doing something like this on a
public website because of the security implications, and you'd have no way
of knowing if Outlook was installed anyway...

Can you describe your environment a bit more...?

--
http://www.markrae.net
yes, sorry it is an intranet site.
"Stew" <Stew@.discussions.microsoft.comwrote in message
news:D4ED302E-5818-4F6A-8FA9-2D63883D3010@.microsoft.com...

Quote:

Originally Posted by

yes, sorry it is an intranet site.


OK, so presumably you have a network mail server to which everybody's local
Outlook connects and which contains the global set of email addresses...?

--
http://www.markrae.net

System.Net.Mail class smtpdemo needs users address in message body from txt.emailAddress

I have this code behind from the new asp.net 2.0 System.Net.Mail class smtpdemo i am working with. It sends an HTML email to myself the from address and to the email address in txt.emailAddress as a CC. I am trying to get the txt.email address somewhere in the message body that it sends out. this code does not show the imputed contents of txt.emailaddress anywhere in the email so i canot reply to the sender. It declaires me as the sender and sends the person filing out the form an email. I need to declar the contents of txt.emailadress as a variable and call it in the message body. Ive tryed dozens of different ways but they all have errors. i hope someone can look at this code and show me how to get the users email address sent with the message.
/code/
Imports System.Net.Mail

PartialClass report_aspx

Inherits System.Web.UI.Page

ProtectedSub sendEmail_Click(ByVal senderAsObject,ByVal e _

As System.EventArgs)Handles sendEmail.Click

Dim sBodyAsString

Dim fileReaderBodyAsString

Dim fileReaderFormatAsString

Dim WebDirectoryAsString = Server.MapPath(".") &"\"

Dim fileNameAsString = WebDirectory

Dim htmlEmailFormatAsString = WebDirectory &"MailFormat.htm"

SelectCase Subject.Text

Case"Broken Link"

fileName = fileName &"BrokenLink.txt"

Case"Missing Picture"

fileName = fileName &"MissingPicture.txt"

Case"Typographical Error"

fileName = fileName &"TypoError.txt"

CaseElse

fileName = fileName &"other.txt"

EndSelect

fileReaderBody =My.Computer.FileSystem.ReadAllText(fileName)

fileReaderFormat =My.Computer.FileSystem.ReadAllText(htmlEmailFormat)

sBody = fileReaderFormat.Replace("BODYGOESHERE", _

messageBody.Text)

sBody = sBody.Replace("CONTENTGOESHERE", fileReaderBody)

sBody = sBody.Replace("SUBJECTGOESHERE", Subject.Text)

Dim toAddressAs MailAddress =New _

MailAddress(me@dotnet.itags.org.myemailaddress,"Webmaster")

Dim ccAddressAs MailAddress =New _

MailAddress(emailAddress.Text, emailName.Text)

Dim SenderAddressAs MailAddress =New _

MailAddress(emailAddress.Text)

Dim fromAddressAs MailAddress =New _

MailAddress(me@dotnet.itags.org.myemailaddress)

Dim eMailAs MailMessage =New _

MailMessage(fromAddress, fromAddress)

eMail.CC.Add(fromAddress)

eMail.Subject = Subject.Text

Dim htmlTypeAs System.Net.Mime.ContentType = _

New System.Net.Mime.ContentType("text/html")

Dim txtTypeAs System.Net.Mime.ContentType = _

New System.Net.Mime.ContentType("text/plain")

eMail.AlternateViews.Add( _

AlternateView.CreateAlternateViewFromString(sBody, htmlType))

eMail.AlternateViews.Add( _

AlternateView.CreateAlternateViewFromString(fileReaderBody & vbCrLf & messageBody.Text, htmlType))

Dim attchmentAs Attachment =New _

Attachment(WebDirectory &"goldbar.gif")

eMail.Attachments.Add(attchment)

Dim clientAs SmtpClient =New SmtpClient("myemailserver")

client.Send(eMail)

lblMessageSent.Text ="MESSAGE SENT"

emailAddress.Text =""

emailName.Text =""

messageBody.Text =""

EndSub

ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Load

EndSub

EndClass
/end code/

I fixed my form by modifying the mailformat.htm page that I will place below and adding:

/codebehind file/
Body = sBody.Replace("NAMEGOESHERE", emailName.Text)

sBody = sBody.Replace("EMAILFROMGOESHERE", emailAddress.Text)
/end codebehind file/
/mailformat.html/

<html><body><h1>SUBJECTGOESHERE</h1><imgsrc="goldbar.gif"/><br/>BODYGOESHERE

<br/>

<imgsrc="goldbar.gif"/><br/>

NAMEGOESHERE<br/>

EMAILFROMGOESHERE<br/>

<br/>

<blockquote>CONTENTGOESHERE</blockquote></body></html>

Tuesday, March 13, 2012

System.Runtime.InteropServices.COMException + Unspecified Error

Hi..

I am using AD and SQL Authentication in my site. I am using ASP.NET 2.0+C#.

I have a web page, in which i can create users. While I try to create an user for the first time, I am getting anUnspecified Error. Repeated trials are successfully creating users in the database and AD, I am using the Authentication mode as:SQL_and_AD_Authentication

In my information log, I have the following stack trace:

Timestamp: 24/09/2007 14:27:32
Message: HandlingInstanceID: 272245f4-2d0a-422a-8d7d-0fdf66ad1b44
An exception of type 'System.Runtime.InteropServices.COMException' occurred and was caught.
----------------------------
09/24/2007 15:27:32
Type : System.Runtime.InteropServices.COMException, mscorlib, Version=2.0.0.0, Culture=neutral,

Message : Unspecified error

Source : App_Web_2b_1-umr
Help link :
ErrorCode : -2147467259
Data : System.Collections.ListDictionaryInternal
TargetSite : Void AddUser()
Stack Trace : at MyAdmin.UI.SiteViewAgents.AddUser()
at MyAdmin.UI.SiteViewAgents.UpdateAgent(String AgentId)

Additional Info:

MachineName : CCQASRV
TimeStamp : 24/09/2007 14:27:32
FullName : Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null

ThreadIdentity :
WindowsIdentity : BTCCOUTBOUND\Administrator

Category: Error
Priority: 0
EventId: 100
Severity: Error
Title:Enterprise Library Exception Handling
Machine: CCQASRV
Application Domain: /LM/W3SVC/1/Root/NGCCManagementFrameworkAdmin_QA2.1-1-128351114095156250
Process Id: 6196
Process Name: c:\windows\system32\inetsrv\w3wp.exe
Win32 Thread Id: 8480
Thread Name:
Extended Properties:

what is this Unspecified Error? Please help..

Thanks

Check this thread to see if it gives some pointers

http://www.eggheadcafe.com/software/aspnet/29434778/cannot-add-user-to-active.aspx

HTH,
Suprotim Agarwal

--
http://www.dotnetcurry.com
--


Hi..

Thank you very much for the reply.. But I couldn't get much help from that.

Thanks


Hi,

In that case, try posting the code which you feel causes the error.

Suprotim.


Hi venkatzeus,

According to MSDN, if the HRESULT is a custom result or if it is unknown to the runtime, the runtime passes a genericCOMException to the client. TheErrorCode property of theCOMException contains the HRESULT value. You can use catch(ComException ex) to catch this type of exception.

http://msdn2.microsoft.com/en-us/library/system.runtime.interopservices.comexception(VS.71).aspx

Hope it helps.


HI..

I searched in google and found out this:

http://support.microsoft.com/kb/232282

It says, it is a Generic COM Error Codes. How to catch these generic COM Error codes and provide more meaningful messages to the end user.

Thanks

loadTOCNode(2, 'moreinformation');