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.

Signature
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com
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
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.

Signature
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 = "list@example.com";
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
Greg Collins [InfoPath MVP] - 20 Jul 2005 21:13 GMT
I understand your concern. Again, I believe that it *might* be possible using managed code, but don't know how to do it. You wil need to do some research into this. I would suggest making a post in a .NET coding newsgroup for help.
With script, I am less confident that you can do it. But it may still be possible.
The alternative is to make sure that any form that will use the code uses the same name for the adapter. Then at least the code will not need to be modified.

Signature
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com
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 news:ujfBmcUjFHA.1148@TK2MSFTNGP12.phx.gbl...
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.

Signature
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com
"A.M" <alanalan@newsgroup.nospam> wrote in message
news:uIFBE0RjFHA.1968@TK2MSFTNGP14.phx.gbl...
Hi,
I use the following code to send an email:
var objEmailAdapter;
objEmailAdapter = XDocument.DataAdapters("EmailSubmit");
objEmailAdapter.To = "list@example.com";
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