c# - Email Attachments Not making it through -



c# - Email Attachments Not making it through -

i have c# programme uses fileuploader command collect path file name attachment email. when run webpage attachment in debug, fine , email comes attachment. however, when deploy server, email makes through attachment not.

mailmessage message = new system.net.mail.mailmessage(); message.to.add("test1@test.com"); message.subject = "project created"; message.from = new mailaddress("noreply@test.com"); message.body = "you have recieved project request " + txtcontactname.text + " project name: " + txtprojectname.text + " priority: " + ddlpriority.selectedvalue.tostring() + " business area: " + ddlbusinessarea.selectedvalue.tostring(); if (fileupload1.filename.length > 0) { if (file.exists(fileupload1.postedfile.filename)) message.attachments.add(new attachment(fileupload1.postedfile.filename)); } smtpclient smtp = new smtpclient("pmfex02"); networkcredential cred = new networkcredential(); cred.username = "test@test.com"; cred.password = "test"; cred.domain = "test.com"; smtp.usedefaultcredentials = false; smtp.send(message);

i have tried , without credentials set, behaves same way. thought why attachment won't create through when deployed server?

add content message subject or body see how far attachment get:

mailmessage message = new system.net.mail.mailmessage(); message.to.add("test1@test.com"); message.subject = "project created"; message.from = new mailaddress("noreply@test.com"); message.body = "you have recieved project request " + txtcontactname.text + " project name: " + txtprojectname.text + " priority: " + ddlpriority.selectedvalue.tostring() + " business area: " + ddlbusinessarea.selectedvalue.tostring(); if (fileupload1.filename.length > 0) { message.subject .= string.format(" ({0} bytes)", fileupload1.filename.length); if (file.exists(fileupload1.postedfile.filename)) { message.subject .= " e"; message.attachments.add(new attachment(fileupload1.postedfile.filename)); } }

it may create sense you, if gets left on there won't wound either.

c# email

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -