Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Problems attaching emails with ASP.Net


Message #1 by "Hugh McLaughlin" <hugh@k...> on Mon, 14 Jan 2002 18:11:03
Hello Everyone and thanks for your help in advance.  I am working on a 

module to send emails using ASP.Net.  Everything is working fine until I 

try to attach a file.  I am using the following code:





<%@ Import Namespace="System.Web.Mail" %>



<%

    Dim Mail As New SmtpMail()

    Dim MailMsg As New MailMessage()

    MailMsg.To = "hugh@k..."

    MailMsg.From = "hugh@k..."

    MailMsg.BodyFormat = MailFormat.Html

    MailMsg.Priority = MailPriority.High

    MailMsg.Subject = "Test Message"

    MailMsg.Body = "Test Message"

Dim FileName As String = "D:\Test.txt"

Mail.Attachments.Add(New MailAttachment(FileName))



    Mail.Send(MailMsg)



    Mail = Nothing

    MailMsg = Nothing



%>



I am receiving the following error message:



Compiler Error Message: BC30456: The name 'Attachments' is not a member 

of 'System.Web.Mail.SmtpMail'



Any help would be greatly appreciated.  Thanks.
Message #2 by "Samuel Engelman" <samuel_engelman@p...> on Mon, 14 Jan 2002 13:27:16 -0500
The proper systex would be MailMsg.Attachments......









|--------+--------------------------------->

|        |   "Hugh McLaughlin"             |

|        |   <hugh@k...>         |

|        |                                 |

|        |                                 |

|        |   Monday January 14, 2002 01:11 |

|        |   PM                            |

|        |   Please respond to "ASP+"      |

|        |                                 |

|--------+--------------------------------->

  >------------------------------------------------------------|

  |                                                            |

  |      To:                                  "ASP+"           |

  |       <aspx@p...>                                  |

  |      cc:                                                   |

  |      Subject: [aspx] Problems attaching emails with ASP.Net|

  >------------------------------------------------------------|









Hello Everyone and thanks for your help in advance.  I am working on a

module to send emails using ASP.Net.  Everything is working fine until I

try to attach a file.  I am using the following code:





<%@ Import Namespace="System.Web.Mail" %>



<%

    Dim Mail As New SmtpMail()

    Dim MailMsg As New MailMessage()

    MailMsg.To = "hugh@k..."

    MailMsg.From = "hugh@k..."

    MailMsg.BodyFormat = MailFormat.Html

    MailMsg.Priority = MailPriority.High

    MailMsg.Subject = "Test Message"

    MailMsg.Body = "Test Message"

Dim FileName As String = "D:\Test.txt"

Mail.Attachments.Add(New MailAttachment(FileName))



    Mail.Send(MailMsg)



    Mail = Nothing

    MailMsg = Nothing



%>



I am receiving the following error message:



Compiler Error Message: BC30456: The name 'Attachments' is not a member

of 'System.Web.Mail.SmtpMail'



Any help would be greatly appreciated.  Thanks.










Message #3 by "GfWeis" <gfw@y...> on Mon, 14 Jan 2002 12:35:11 -0600
You can find a C# example at

http://dn.yyyz.net/DnYzArticleShow.aspx?WA=18



Gfw



-----Original Message-----

From: Samuel Engelman [mailto:samuel_engelman@p...] 

Sent: Monday, January 14, 2002 12:27 PM

To: ASP+

Subject: [aspx] Re: Problems attaching emails with ASP.Net





The proper systex would be MailMsg.Attachments......









|--------+--------------------------------->

|        |   "Hugh McLaughlin"             |

|        |   <hugh@k...>         |

|        |                                 |

|        |                                 |

|        |   Monday January 14, 2002 01:11 |

|        |   PM                            |

|        |   Please respond to "ASP+"      |

|        |                                 |

|--------+--------------------------------->

  >------------------------------------------------------------|

  |                                                            |

  |      To:                                  "ASP+"           |

  |       <aspx@p...>                                  |

  |      cc:                                                   |

  |      Subject: [aspx] Problems attaching emails with ASP.Net|

  >------------------------------------------------------------|









Hello Everyone and thanks for your help in advance.  I am working on a

module to send emails using ASP.Net.  Everything is working fine until I

try to attach a file.  I am using the following code:





<%@ Import Namespace="System.Web.Mail" %>



<%

    Dim Mail As New SmtpMail()

    Dim MailMsg As New MailMessage()

    MailMsg.To = "hugh@k..."

    MailMsg.From = "hugh@k..."

    MailMsg.BodyFormat = MailFormat.Html

    MailMsg.Priority = MailPriority.High

    MailMsg.Subject = "Test Message"

    MailMsg.Body = "Test Message"

Dim FileName As String = "D:\Test.txt"

Mail.Attachments.Add(New MailAttachment(FileName))



    Mail.Send(MailMsg)



    Mail = Nothing

    MailMsg = Nothing



%>



I am receiving the following error message:



Compiler Error Message: BC30456: The name 'Attachments' is not a member

of 'System.Web.Mail.SmtpMail'



Any help would be greatly appreciated.  Thanks.

---

Change your mail options at http://p2p.wrox.com/manager.asp or to

unsubscribe send a blank email to $subst('Email.Unsub').














Message #4 by "Hugh McLaughlin" <hugh@k...> on Mon, 14 Jan 2002 18:59:46
> The proper systex would be MailMsg.Attachments......

> 

> 

> 

> 

> |--------+--------------------------------->

> |        |   "Hugh McLaughlin"             |

> |        |   <hugh@k...>         |

> |        |                                 |

> |        |                                 |

> |        |   Monday January 14, 2002 01:11 |

> |        |   PM                            |

> |        |   Please respond to "ASP+"      |

> |        |                                 |

> |--------+--------------------------------->

>   >------------------------------------------------------------|

>   |                                                            |

>   |      To:                                  "ASP+"           |

>   |       <aspx@p...>                                  |

>   |      cc:                                                   |

>   |      Subject: [aspx] Problems attaching emails with ASP.Net|

>   >------------------------------------------------------------|

> 

> 

> 

> 

> Hello Everyone and thanks for your help in advance.  I am working on a

> module to send emails using ASP.Net.  Everything is working fine until I

> try to attach a file.  I am using the following code:

> 

> 

> <%@ Import Namespace="System.Web.Mail" %>

> 

> <%

>     Dim Mail As New SmtpMail()

>     Dim MailMsg As New MailMessage()

>     MailMsg.To = "hugh@k..."

>     MailMsg.From = "hugh@k..."

>     MailMsg.BodyFormat = MailFormat.Html

>     MailMsg.Priority = MailPriority.High

>     MailMsg.Subject = "Test Message"

>     MailMsg.Body = "Test Message"

> Dim FileName As String = "D:\Test.txt"

> Mail.Attachments.Add(New MailAttachment(FileName))

> 

>     Mail.Send(MailMsg)

> 

>     Mail = Nothing

>     MailMsg = Nothing

> 

> %>

> 

> I am receiving the following error message:

> 

> Compiler Error Message: BC30456: The name 'Attachments' is not a member

> of 'System.Web.Mail.SmtpMail'

> 

> Any help would be greatly appreciated.  Thanks.




> 

> 

> 

Thank You.

  Return to Index