Question about sending emails

A

A.M

Hi,

I use the following code to send an email:

var objEmailAdapter;
objEmailAdapter = XDocument.DataAdapters("EmailSubmit");

objEmailAdapter.To = "(e-mail address removed)";
objEmailAdapter.Subject = "Status Report";
objEmailAdapter.Submit();


The problem is I have to create an email adapter (in above code called
"EmailSubmit") to make above code work.

Can I create the email adapter within the code, so developers won't have to
create the email adapter to be able to use above code?

Thank you,
Alan
 
A

A.M

Hi Greg,



Thank you for reply.



There is no problem if I want to use the code within the same template, but
that is not the reason I posted the question.



The problem is if I need to use the code within another 50-60 other new
template, then I need to create the dummy MailAdapter with specific name for
each new template. It is nice to make the adapter independent.



Is it hard -or- impossible to create the email adapter within the code?



Thank you,

Alan





"Greg Collins [InfoPath MVP]" <Greg.Collins_AT_InfoPathDev.com> wrote in
message Someone may wish to correct me, but I believe you need to use the InfoPath
email adapter. If you were using managed code, I would guess there would be
a way around it, though I don't know off-hand what that would be.

If you create the adapter for your form template, then why do you feel that
developers need to create their own adapter. Any code in that form template
will use the adapter also created in that form template. There should be no
reason for other developers using the same template to have to create
another adapter.

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com




Hi,

I use the following code to send an email:

var objEmailAdapter;
objEmailAdapter = XDocument.DataAdapters("EmailSubmit");

objEmailAdapter.To = "(e-mail address removed)";
objEmailAdapter.Subject = "Status Report";
objEmailAdapter.Submit();


The problem is I have to create an email adapter (in above code called
"EmailSubmit") to make above code work.

Can I create the email adapter within the code, so developers won't have to
create the email adapter to be able to use above code?

Thank you,
Alan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top