Sending an attachment in an email

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 лет назад
Hi

We are a paying user of NopCommerce :P

I was looking at your API. We have made some minor modifications to your source code to fit our needs.
I love your emailing functionality, but I was wondering if the email API  has functionality to attach files to emails as we need to mail an attached file to some customers. I briefly searched for support in the API but couldn't find it.

If there is not, is this something planned for a future release? ....if requested can it be added?


If not, would it be simpler for me to added to your current API than emailing using other dot net build in stuff??



Note.
I am a C++ programmer with some experience on C# applications, but not too much on C# websites so I hope I'm not sounding too newbie here
13 лет назад
You can attach items to an email but you do need to modify the messagemanager.cs file..

the only gotcha is then you can't send that email using the queue functionality that exists.. you need to send it immediately..

I'm not sure what kind of implications that would have but i figure if you wrapped it in a try catch and wrote to the log on email failure it'd help track stuff down if there happened to be an error..


I was actually working on attaching a custom pdf giftvoucher last night in message manager and had to do just that.. so now when my customers get a gift voucher email a printable pdf is attached that a customer could print and give to a friend..

if you need some help with what code to modify let me know but basically if you look at messagemanager and find the method related to the type of email you want to send you can remove the queuing functionality and manually attach stuff in that method and call send..
13 лет назад
thomen wrote:
You can attach items to an email but you do need to modify the messagemanager.cs file..

the only gotcha is then you can't send that email using the queue functionality that exists.. you need to send it immediately..

I'm not sure what kind of implications that would have but i figure if you wrapped it in a try catch and wrote to the log on email failure it'd help track stuff down if there happened to be an error..


I was actually working on attaching a custom pdf giftvoucher last night in message manager and had to do just that.. so now when my customers get a gift voucher email a printable pdf is attached that a customer could print and give to a friend..

if you need some help with what code to modify let me know but basically if you look at messagemanager and find the method related to the type of email you want to send you can remove the queuing functionality and manually attach stuff in that method and call send..



Great, thanks !

I figured out. It was very simple.  Sadly there is no support in the queue  functionality for attachments.


This works for me thou.
13 лет назад
so did you end up manually mapping the path to the file you needed to attach because Server.MapPath isn't available in the business layer?
I'd love to see your solution!
Cheers,
Tom
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.