Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fredrik 41 posts 161 karma points
    Oct 19, 2009 @ 11:13
    Fredrik
    0

    Mail not being received - Cultiv Contact Form

    Hello!

    Our client wants to receive mail from the contact form but we can't use his mail.
    So what I did was make a new mailuser for the site that will stand in the web.config file, receive the mail and make the mailuser I created automaticly forward the mail to our clients mail.

    When I send from the form to the mailuser it's getting deleted each time. I think this is because some anti spam mailservers got.(i'll try to explain it the best I can)
    When I choose the sender in the contact form, let's say [email protected], the mailserver will notice that it's not really [email protected] that is sending the mail, but the mailuser I've created.
    What happens now is that the mailserver thinks someone are sending mail with a fake mailuser and therefore automaticly deletes the mail.

    One solution I think is to remove the email from the contact form and let it come in normal text, then the client will see that the mail is from the mailuser i've created, but the e-mail from his clients will still stand in cleartext inside the mail.

    My programming skills aren't the best, so I am not quite sure where to edit this.

    So do you think you can help me out a little?  :)

    Regards,
    Fredrik

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Oct 19, 2009 @ 12:00
    Sebastiaan Janssen
    1

    This is the code that sets the "from" address:

                if (_contactName.Text == string.Empty)
                    mail.From = new MailAddress(HttpUtility.HtmlEncode(_contactEmail.Text));
                else
                    mail.From = new MailAddress(HttpUtility.HtmlEncode(_contactEmail.Text), HttpUtility.HtmlEncode(_contactName.Text));

    You could easily modify that to use a static e-mail address, just replace the whole bit with:

    mail.from = "[email protected]";

    The e-mail address is already shown in plain text at the bottom of the e-mail.

  • Fredrik 41 posts 161 karma points
    Oct 19, 2009 @ 13:11
    Fredrik
    0

    Sorry for asking really stupid now, but I can't find where the code you just pasted is. = /

     

  • Fredrik 41 posts 161 karma points
    Oct 19, 2009 @ 14:12
    Fredrik
    0

    Found it in the .dll file now. Will mark as solved if I figure it out. Thanks for input :)

    *
    Fredrik

  • Adam 14 posts 34 karma points
    Aug 28, 2010 @ 20:29
    Adam
    0

    I apologise for a possibly ignorant question, but how do I access the .dll file and see the code segment? 

    It's mostly garbled to me, and I am not aware of a .dll 'reader/editor' to look inside.

    Cheers, Adam

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Aug 28, 2010 @ 21:08
    Jan Skovgaard
    0

    Hi Adam

    I guess the .dll file can be decompiled using Reflector http://www.red-gate.com/products/reflector/ - But I think that's a bit cumbersome, since the source code for the package is available on Codeplex, which is being linked from the package site.

    /Jan

  • Adam 14 posts 34 karma points
    Aug 29, 2010 @ 12:00
    Adam
    0

    Ok. Thanks for that tip. I've now downloaded the source code there and have attempted to alter some of the .aspx.cs code just to test, but it looks like it is not being referenced or looked at when running.

    1. Is it possible for me to "unlink" it from the package site in order make it to look at my newly altered file instead?

    2. Would I need to recompile the altered code (somehow) to create a new .dll?

    Adam

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Aug 29, 2010 @ 22:40
    Jan Skovgaard
    0

    Hi Adam

    If you have opened the project an altered the code you should build your solution - it compiles/updates the .dll file, which you can the upload into the bin folder and overwrite the exiting one.

    If you have made changes to the usercontrol (ascx) it should be uploaded into the usercontrols folder as well.

    /Jan

  • Adam 14 posts 34 karma points
    Aug 31, 2010 @ 18:02
    Adam
    0

    Hi Jan,

    Thanks for your ideas. It sounded so easy. I have done as you have suggested.Using MS C#2008 Express. No luck yet.

    1. )  When I rerun the updated macro I receive the following error in the tracestack:

    Error creating usercontrol (/usercontrols/CultivContactForm.ascx)
    The type 'CultivContactForm.CultivContactForm' is ambiguous: it could come from assembly 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\85f608c1\7ae2fc52\App_Code.nmfedzwl.DLL' or from assembly 'C:\inetpub\wwwroot\build\bin\CultivContactForm.DLL'. Please specify the assembly explicitly in the type name.

    2)  I have gone through countless forums in order to resolve this. It appears that during the building of the project there is a temporary reference to a similar DLL file in the ..\Framework\.. location. Even if I rename the conflicting file, the error still appears. I have tried renaming the type to CultivContactFormTest.CultivContactForm in both the   .ascx.designer.cs   and the .ascx.cs  without any luck (as this is what I'm working on here.... being a newbie).

    3)  Some forums have suggested deleting the Inherits="CultivContactForm.CultivContactForm" from the <% ... %> area in CultivContactForm.ascx file.

    None of these things have worked for me.

    I simply want to add a dropdownlist with REASONS FOR  YOUR ENQUIRY being listed, the selection to be included automatically in their email as I had done via php outside of umbraco.

    Any ideas please? (perhaps even pointing me in the direction of already clear wiki/forum on "how to extend .net macros"

    Cheers, Adam

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Aug 31, 2010 @ 20:42
    Jan Skovgaard
    0

    Hi Adam

    When you made your build did you then copy the dll to the bin folder AND copy the user control as well?

    If so...did you compile against the correct umbraco dll's?

    /Jan

  • Adam 14 posts 34 karma points
    Sep 01, 2010 @ 11:27
    Adam
    0

    Hi Jan,

    Yes to both the first 2 questions. I have followed the process below with the original code downloaded from Codeplex, and also after editing in my own code, with identical result.

    I HAVE NOW GOT IT WORKING without CultivContactForm.dll from the \bin folder, but I don't know how it will work on a Live server due to step 9.

    This is my process:

    1)  In MS C# 2008 Express I dragged the CultivContactForm.ascx, CultivContactForm.ascx.cs and CultivContactForm.ascx.designer.cs into a new project called CultivContactForm using the Class Library template..

    2)  Then I Add Reference to Recaptcha.dll, umbraco.dll, System.Web.dll v2.05 (v4.0 has '!' beside it for some reason) as expected in "using" section at the top of the .ascx.cs file.

    (I have selected .Net Framework V4.0 and Integrated in the application pool in IIS - is this a possible conflict?)

    3)  I then add the DropDownList to the .ascx, .ascx.designer.cs, and the .ascx.cs files.

    4)  Save and Build Project.

    5) Copy  CultivContactForm.dll to \build\bin folder. 

                 CultivContactForm.ascx to \usercontrols folder.

                 CultivContactForm.ascx.cs and CultivContactForm.ascx.designer.cs to \App_Code folder.

    6) Create macro called CultivContactForm and select my .ascx as the .NET User Control file.

    7) Add macro to my template.

    8) Browse to page and hey presto... the Error: Error creating usercontrol (usercontrols/CultivContactForm.ascx)
    The type 'CultivContactForm.CultivContactForm' is ambiguous: it could come from assembly 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\85f608c1\7ae2fc52\App_Code.yqdfgqks.DLL' or from assembly 'C:\inetpub\wwwroot\build\bin\CultivContactForm.DLL'. Please specify the assembly explicitly in the type name.

    (occasionally this error is in the tracestack also:  Master template is the same as the current template. It would course an endless loop!)

    9) When I delete the new CultivContactForm.dll from the \bin folder the ambiguity apparently disappears, and IT WORKS!

    So according to the error I need to "specify the assembly explicitly in the type name". How is this done?

    I hope this makes it easy to 'guess' where I may be going wrong.

     

    Cheers

    Adam


  • Adam 14 posts 34 karma points
    Sep 03, 2010 @ 09:26
    Adam
    0

    Latest update:

    I now have it working on the test environment: without the .ascx.designer.cs, and the .ascx.cs files in the \App_Code folder AND with the .dll file in the \bin folder.

    (Fingers crossed it will work when live.)

    Thanks for your assistance. :)

    Cheers,

    Adam

Please Sign in or register to post replies

Write your reply to:

Draft