function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kaybeekaybee 

Opt out/opt in email options

Hi there,
 
I'm looking to create a registered users area on our website, which will allow users to register to download documents, but more importantly they can opt in to receiving emails from us. 
 
I would like to then store these 'leads' in Salesforce.
 
However, if the user asks to opt out of receiving email, I would like this to be stored in Salesforce with a flag ensuring that person is not sent emails.  I would then be able to only send email to those who had specifically asked to opt in.
 
Any idea if this is possible?
 
Rasmus MenckeRasmus Mencke
There is an opt-out flag on leads and contact records, that will block you from sending mass emails to those records. You can install an opt-out emails service that will update the unsubscribe flag based on an email your customer sends back.

On developer Wiki:
https://wiki.apexdevnet.com/index.php/Force.com_Email_Services_Unsubscribe

or you can install from AppExchange:
http://www.salesforce.com/appexchange/detail_overview.jsp?id=a0330000005AzOgAAK
kaybeekaybee
Fabulous!  Thank you!
ForceableForceable

Rasmus -

I  installed this according to the directions in the Configuration Guide. After setting everything up, I tried to test the functionality of the Unsubscribe code by clicking on the link provided in my template and sending a test email to the email address created in SalesForce. I verified that the subject was "unsubscribe" (made it lower case, to eliminate variables), and the the email address I was sending to was exactly the same as the one in the system. I checked the lead, and the Email Opt Out remained False. I then set the action for a deactivated address to bounce, and deactivated the address and tried again. I did get the bounce, so I know that the email address is working, at least to bounce when deactivated. I tried this with a few differenct end-user email addresses in a few different lead records, with no different results after reactivating the email address in Salesforce. No results.

Do you have suggestions for troubleshooting this? I couldn't even find a place to view a debug log, etc, for the App.

Thanks.

Ken

ForceableForceable

I did finally figure out the debug logs. Here is what I see:

StatusSuccessApplicationUnknown
Request TypeApplicationOperationAPEXSOAP
Duration (ms)65Log Length1,458
Log
20080508003721.107:Class.unsubscribe.handleInboundEmail: line 33, column 6: SelectLoop:LIST:SOBJECT:Contact
20080508003721.107:Class.unsubscribe.handleInboundEmail: line 33, column 23: SOQL query with 0 rows finished in 4 ms
20080508003721.107:Class.unsubscribe.handleInboundEmail: line 45, column 9: Update: LIST:SOBJECT:Contact
20080508003721.107:Class.unsubscribe.handleInboundEmail: line 53, column 6: SelectLoop:LIST:SOBJECT:Lead
20080508003721.107:Class.unsubscribe.handleInboundEmail: line 53, column 20: SOQL query with 0 rows finished in 3 ms
20080508003721.107:Class.unsubscribe.handleInboundEmail: line 66, column 9: Update: LIST:SOBJECT:Lead
20080508003721.107:Class.unsubscribe.handleInboundEmail: line 73, column 5: Found the unsubscribe word in the subject line.
20080508003721.107:Class.unsubscribe: line 3, column 37:     returning Messaging.InboundEmailResult from method global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail, Messaging.InboundEnvelope) in 8 ms

Cumulative resource usage:

Resource usage for namespace: (default)
Number of SOQL queries: 2 out of 100
Number of query rows: 0 out of 10000
Number of SOSL queries: 0 out of 20
Number of DML statements: 0 out of 100
Number of DML rows: 0 out of 10000
Number of script statements: 12 out of 200000
Maximum heap size: 0 out of 1000000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10

Total email recipients queued to be sent : 0
  

Does this help determine why this isn't working properly?
 
ForceableForceable
I think I figured out the problem.
 
The Apex class seems to employ a limit of 100 when Looping to inspect Leads. Does this mean that it will only look at 100 leads? We have far more than this, but I do not have the capability to Edit the Apex Class.
 
Could you provide a class with a limit of more like 100,000 for both Leads and Contacts?
 
 
Rasmus MenckeRasmus Mencke
they 100 limit refers to the result set, it basically limits you to get back 100 matching leads. So if you lookup user@acme.com and you find more than 100 leads with that email address, the query will only return the 100 first results.
ForceableForceable

That certainly makes more sense, and i thought of this after I posted last night.

I still have not been able to make this work, per my postings above. Do you have any additional suggestions for troubleshooting? I have uninstalled and reinstalled to be sure I followed the procedure properly to no avail.

 

dlaidigdlaidig

did you figure this out?  I am exactly at the place you were at.  I set everything up, but nothing happens.  I don't know where to go from here.

 

update--

i did some more testing and found that i am getting an failure for "Unauthorized Sender Action" in my Email Services.  When i change the value to Bounce Message, i get a rejected email every time.  I found that when creating the Email Address in in the email services page, it automatically puts in your salesforce email address as the only email address accepted for the action.  Once i deleted this email address from that textbox, i was good to go.

Message Edited by dlaidig on 03-27-2009 07:05 AM
jinnerarityjinnerarity

Hi, did you ever get this working? As i am at exactly the same point. and i can't seem to get it working.

dianepdianep

Did anyone get this to work?