Hello,
I've created a pdf (using your aspose.pdf) in a memorystream (I'm not sure if you can do this?!) and I'm trying to attach it to an email (using your aspose.email), but it doesn't seem to be working. Please can you help. I'm using ASP.NET 1.1
Basically I don't want the pdf to be displayed or saved to disk, just emailed. Is this possible?
Here is my code. It's in VB.
--------------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
...
Dim p As Pdf
...
p = Invoice.CreatePdf()
Dim pdfStream = New MemoryStream
p.Save(pdfStream)
sendAspEmail(pdfStream)
Response.End()
End Sub
Private Sub sendAspEmail(ByRef pdfSteam As MemoryStream)
Dim msg = New Aspose.Email.Message
msg.From = New Aspose.Email.Address("email@home.com")
msg.ReplyTo = New Aspose.Email.Address("email@home.com")
msg.AddAddress(New Aspose.Email.Address("email@home.com"), Aspose.Email.Address.Type.To)
msg.Subject = "Mail subject"
msg.MailPriority = Message.Priority.Highest
msg.Date = DateTime.Now
msg.Confirmation = False
msg.AllowRefusedAddresses = True
Dim x As String
x = "" & "Test email" & ""
Dim htmlBody = New Aspose.Email.TextHtmlBody
htmlBody.Content = x
htmlBody.Charset = "UTF-8"
Dim altBody = New Aspose.Email.AlternativeBody
altBody.AddPart(htmlBody)
msg.Body = altBody
Dim attachment = New Aspose.Email.Attachment(pdfSteam, "invoice.pdf", New Aspose.Email.Config.NullTempFileNameProvider)
msg.AddAttachment(attachment)
msg.Send(New SmtpAccount("relay.plus.net", 25, "", ""), New ProgressMonitor)
End Sub
--------------------------------------------------------------
Many Thanks
William Roscoe