|
Answer» Hi guys,
it is working perfectly in c#. When I execute this CODE on site then I'm facing problem regarging attachment. using system.web.mail; MailMessage mail = new MailMessage(); mail.From = "[emailprotected]"; mail.To = "[emailprotected]"; mail.Subject = "Urgent Subject"; mail.Body = "dear,..."; SmtpMail.SmtpServer = "localhost"; MailAttachment attach = new MailAttachment("C:\\TEST.TXT"); mail.Attachments.Add(attach); SmtpMail.Send(mail);
OUT PUT : INVALID ATTACHMENT "C:\TEST.TXT'You have
("C:\\TEST.TXT")
have you tried
("C:\TEST.TXT")
PS: You may want to CHANGE your Subject to something that actually describes your post)Read 106 times, answered once. Twice now. Do you not need a username and password to send mail? You could be sending the email from any address you want...
Have you tried PHP?
"mailform.php"....
Code: [Select]<html> <body>
<?php if(isset($_REQUEST['email'])) //if"email"isfilledout,sendemail { //sendemail $email=$_REQUEST['email']; $subject=$_REQUEST['subject']; $message=$_REQUEST['message']; mail("[emailprotected]","Subject:$subject", $message,"From:$email"); echo"Thankyouforusingourmailform."; } else //if"email"isnotfilledout,displaytheform { echo"<formmethod='post'action='mailform.php'> Email:<inputname='email'type='text'/><br/> Subject:<inputname='subject'type='text'/><br/> Message:<br/> <textareaname='message'rows='15'cols='40'> </textarea><br/> <inputtype='submit'/> </form>"; } ?>
</body> </html>
|