Ouvrez outlook avec javascript pour l'envoi de mail avec pièce jointe en c#
je suis à l'aide de javascript pour ouvrir le client de messagerie par défaut dans asp.net c# une application web.
ci-dessous mon code..
<script language="javascript">
function SendAttach() {
var theApp //Reference to Outlook.Application
var theMailItem //Outlook.mailItem
//Attach Files to the email
var attach3 = "c:\\mail\\test.txt"
//Construct the Email including To(address),subject,body
//var recipient
var subject = "Email Using JavaScript"
var msg = "This is a test mail,sent to you using javascript by kushan thakershy"
//Create a object of Outlook.Application
try {
var theApp = new ActiveXObject("Outlook.Application");
var objNS = theApp.GetNameSpace('MAPI');
var theMailItem = theApp.CreateItem(0) //value 0 = MailItem
//Bind the variables with the email
theMailItem.to = "[email protected]"
theMailItem.Subject = (subject);
theMailItem.Body = (msg);
theMailItem.Attachments.add(attach3);
theMailItem.display();
//Show the mail before sending for review purpose
//You can directly use the theMailItem.send() function
//if you do not want to show the message.
}
catch (err) {
alert("The following may have cause this error: \n" +
"1. The Outlook express 2003 is not installed on the machine.\n" +
"2. The msoutl.olb is not availabe at the location " +
"C:\\Program Files\\Microsoft Office\\OFFICE11\\msoutl.old on client's machine " +
"due to bad installation of the office 2003." +
"Re-Install office2003 with default settings.\n" +
"3. The Initialize and Scripts ActiveX controls not marked as safe is not set to enable.")
document.write("<a href=\"" + "./testemail.asp" + "\"" + ">" + "Go Back" + "</a>")
}
}
cela fonctionne bien mais dans mon cas, je veux obtenir un fichier de la pièce jointe chemin de côté de serveur de code parce que je veux envoyer le rapport crystal en tant que pièce jointe.
comment puis-je obtenir ce chemin de côté de serveur??
- double possible de l'ouverture d'Outlook à l'aide de javascript
- Malgré son titre, l'autre question est: ActiveX
- Veuillez préciser "server-side" dans plus de détails.... tu veux dire de rapport Crystal .fichier rpt ou souhaitez joindre un rapport généré à partir de crystal rapport(au format désiré .doc / .xls / .pdf)?
Vous devez vous connecter pour publier un commentaire.
vérifier le lien l'ouverture d'Outlook à l'aide de javascript OU/Et Cette une
Vous pouvez essayer cette partie de code