• l.trinci
  • NEWBIE
  • 5 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 9
    Replies

Is there a way to send mass email to a custom object with an email template?  

 

 

 

Thanks in advance

Is there any way to remove the Hyperlinks on a pdf page?

This is my code and all i want to do is remove the Hyperlinks on the outputfield value

Thanks in advance


<apex:pageblock >
<apex:repeat value="{!ExpOth}" var="experience" id="RepExp" rendered="{!IF(CONTAINS('skill','Client'), false, true)}">
<apex:repeat value="{!experience.Skills_Techical__r}" var="skillexperience" id="RepSkillExp" rendered="{!IF(CONTAINS('skill','Client'), false, true)}">


<apex:outputfield value="{!skillexperience.Position_name__c}" style="font-weight:bold;"/>
- &nbsp; <apex:outputfield value="{!skillexperience.Skill_Area_name__c}" style="font-weight:bold;"/>

 



</apex:repeat>

</apex:repeat>
</apex:pageblock>


All i want to do is Don't repeat the red part of the code, and i must keep it in the same position of the it:

how can I do? 

 

<apex:pageblock >
<apex:repeat value="{!ExpOth}" var="experience" id="RepExp" rendered="{!IF(CONTAINS('skill','Client'), false, true)}">
<apex:repeat value="{!experience.Skills_Techical__r}" var="skillexperience" id="RepSkillExp" rendered="{!IF(CONTAINS('skill','Client'), false, true)}">

 

<apex:outputtext value="Skill aggiuntivi" rendered="{!IF(experience.Skills_Techical__r=null ,false,true)}" escape="false" />&nbsp;
<hr>
</hr>

 

 

<apex:outputtext value="Skill:" rendered="{!IF(experience.Skills_Techical__r=null ,false,true)}" escape="false" />
<apex:outputfield value="{!skillexperience.Position_name__c}"/>
- &nbsp; <apex:outputfield value="{!skillexperience.Skill_Area_name__c}"/><br/>



</apex:repeat>
</apex:repeat>
</apex:pageblock>

 

 

Thanks in advance

I have no problem on displaing an image on a visualforce page from a controller, but when i try to do the same thing on a email (A mass email in my case) it seems don't work (the document is externally available)

 

Here is my code:

 

public string getDocumentLogoUrl()

{

List<Document> lstDocument = [Select Id,Name,LastModifiedById from Document where Name = 'Header' limit 1];
string strOrgId = UserInfo.getOrganizationId();
string strDocUrl = 'https://'+ApexPages.currentPage().getHeaders().get('Host')+ '/servlet/servlet.ImageServer?id='+lstDocument[0].Id+'&oid=' + strOrgId;

return strDocUrl;

}

 

 

 

public static void sendMail(string email, string first_name, string last_name) {


Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {email};
mail.setToAddresses(toAddresses);

mail.setSubject('xxx');

mail.setHtmlBody('<img url="{!DocumentLogoUrl}" styleClass="photo"></apex:img><br/><br/>Salve '+First_Name+' '+last_name+');



Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}

(Edited after Doomsday reply)

 

Like always, thanks in advance

 

There is a way to create a static resources by a command action, or to fill a empty static resources by a visualforce page or apex class?

 

 

Thanks in advance

There is any way to create a visualforce page that  create a page rendered as a "pdf" that have a button for "insert images"?

 

I need to have an "image" system input on the pdf page (for a manage package) that insert the  "user declared image" on the pdf page..

Like an "insert avatar" botton on the forums

 

 

 

 

 

 

 

Thanks in advance

I know that the email template on mass email is related only to user and contact, but my question is: there is a way to do a mass email on a custom object?!

 

This is my apex class:

 


public with sharing class MassEmail
{
public List<Applicant_test__c> usr{get;set;} //
public List<String> usr_email{get;set;}
public Map<string,string> Map_usr{get;set;}
public string emailid{get;set;}
public string provaemail;
Contact con = new contact();


public void getprovaemail()
{
Contact con = new contact();
con = [Select Id from Contact where Id = :'a0D?fcf=00Bd0000003kLEZ'];
usr=new List<Applicant_test__c>();
usr_email=new List<String>();
usr.clear();
usr_email.clear();
usr=[select Email__c from Applicant_test__c where Keep_in_touch__c=true];
for(Applicant_test__c u : usr)
{
system.debug('___________Email______________'+u.Email__c);
if(u.Email__c!=null)
usr_email.add(u.Email__c);
}
if(usr_email.size()>0)
sendmail(usr_email);
}
public void sendmail(List<String> str)
{
Messaging.reserveSingleEmailCapacity(4);
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();

EmailTemplate EmailTemp = [SELECT id FROM EmailTemplate WHERE developerName = 'Standard_New_Interview'];
email.setTemplateId(EmailTemp.Id);
email.setSaveAsActivity(true);

 


//email.setTargetObjectId(Applican_test id);



Messaging.sendEmail(New Messaging.SingleEmailMessage[]{email});

}
}

 

 

Thanks in advance

I was looking for a solution on this code:

(The problem is that  the code run perfectly but the email don't come on the email address in any way)

 


public with sharing class MassEmail
{
public List<Applicant_test__c> usr{get;set;} 
public List<String> usr_email{get;set;}
public Map<string,string> Map_usr{get;set;}

public string testemail;



public string gettestemail()
{


usr=new List<Applicant_test__c>();
usr_email=new List<String>();
usr.clear();
usr_email.clear();
usr=[select Email__c from Applicant_test__c where Keep_in_touch__c=true];


for(Applicant_test__c u : usr)
{
system.debug('___________Email______________'+u.Email__c);

if(u.Email__c!=null)
usr_email.add(u.Email__c);
}
if(usr_email.size()>0)
sendmail(usr_email);
return null;
}

public void sendmail(List<String> str)
{
system.debug('dentro il sendmail');
Messaging.reserveSingleEmailCapacity(4);
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();


email.setToAddresses(new String[] {'abc@gmail.it'});

String[] toaddress=str;
String[] ccAddresses=new String[]{'abc@tgmail.it'};
email.setSubject('Mass Email');
email.setHtmlBody('Dear Sir /Madam,<br/><br/> Hello <br/><br/>Sincerely,<br><br/><br/>Date :'+string.valueof(system.today()));
email.setToAddresses(toaddress);
email.setCcAddresses(ccAddresses);
Messaging.sendEmail(New Messaging.SingleEmailMessage[]{email});


}

 

Thanks

I was looking for any guide or tips about how to use the 

contenttype="application/vns.ms-word"-"application/rtf"-"vdn.ms-word.document.macroEnabled.12

Because i need to display in doc document all the information as if it were rendered in a pdf

 

The only way i know to "render" the visualforce page as a doc document is:

contentType="application/msword.doc"

 

My question is: Can i show the header and the footer in the doc document resultant?

 

in my tests do not appear, when it is printed to the screen with no problems with "render as pdf"

 

 

apex:

<body>

 

<!-- All Pages Header -->
<c:PDFHeaderFooter type="header" position="center">
<div style="padding: 0px; background-color: #FFFFFF"><img src="{!URLFOR($Resource.Header)}"/></div></c:PDFHeaderFooter>


<!-- All Pages Footer -->
<c:PDFHeaderFooter type="footer" position="left">
<div style="padding: 10px; background-color: #FFFFFF"><img src="{!URLFOR($Resource.Footer)}"/></div></c:PDFHeaderFooter>
<c:PDFHeaderFooter type="footer" position="right" showPageNumbers="true"/>

<!-- Content -->
<h1 style="padding-top: 0px; background-color: #FFFFFF;"><div id="main" class="clearfix">
<div align="left" style="margin-top: 0px;">
<div><h3>Informazioni personali</h3></div>
<hr>
</hr>

 

visualforce component:

<apex:component >
    <!-- Component Attributes -->
    <apex:attribute type="string" name="type"
        description="Determines if the component renders as a header or footer" />
    <apex:attribute type="string" name="position"
        description="Determines if component should render the text on the left, center, or right" />
    <apex:attribute type="boolean" name="showPageNumbers"
        description="Determines if the header/footer information displays the page number information." />
        
    <!-- Component Variables -->    
    <apex:variable var="styleClass" value="{!LOWER(type)}_{!LOWER(position)}"/>
    
    <!-- Component Body -->
    <apex:outputPanel id="panelHeaderFooter" 
        styleClass="{!styleClass}"
        layout="block">
        
       
        
        <apex:componentBody />
    </apex:outputPanel>
</apex:component>

css:

@page { 
	size: letter portrait;
	
	margin-top: 180px;
	margin-bottom: 100px;
	
	@top-left {
		content: element(header_left);
	}
	
	@top-center {
		content: element(header_center);
	}
	
	@top-right {
		content: element(header_right);
	}
	
	@bottom-left {
		content: element(footer_left);
	}
	
	@bottom-center {
		content: element(footer_center);
	}
	
	@bottom-right {
		content: element(footer_right);
	}
}

.header_left {
	text-align: left;
    position: running(header_left);
}

.header_center{
	text-align: center;
	position: running(header_center);
}

.header_right {
	text-align: right;
	position: running(header_right);
}

.footer_left {
	text-align: left;
	position: running(footer_left);
}

.footer_center {
	text-align: center;
	position: running(footer_center);
}

.footer_right {
	text-align: right;
	position: running(footer_right);
}

.pageNumber:before {
	content: counter(page); 
}

.pageCount:before {
	content: counter(pages);  
}

 

Thanks

Hi, I was looking for a solution of this problem:

 

I need to include on my html/apex code a header and a footer that will be shown in every page created with different body(content)

 

I saved my footer and my header as static resources 

 

 

Thanks


I have no problem on displaing an image on a visualforce page from a controller, but when i try to do the same thing on a email (A mass email in my case) it seems don't work (the document is externally available)

 

Here is my code:

 

public string getDocumentLogoUrl()

{

List<Document> lstDocument = [Select Id,Name,LastModifiedById from Document where Name = 'Header' limit 1];
string strOrgId = UserInfo.getOrganizationId();
string strDocUrl = 'https://'+ApexPages.currentPage().getHeaders().get('Host')+ '/servlet/servlet.ImageServer?id='+lstDocument[0].Id+'&oid=' + strOrgId;

return strDocUrl;

}

 

 

 

public static void sendMail(string email, string first_name, string last_name) {


Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {email};
mail.setToAddresses(toAddresses);

mail.setSubject('xxx');

mail.setHtmlBody('<img url="{!DocumentLogoUrl}" styleClass="photo"></apex:img><br/><br/>Salve '+First_Name+' '+last_name+');



Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}

(Edited after Doomsday reply)

 

Like always, thanks in advance

 

Is there any way to remove the Hyperlinks on a pdf page?

This is my code and all i want to do is remove the Hyperlinks on the outputfield value

Thanks in advance


<apex:pageblock >
<apex:repeat value="{!ExpOth}" var="experience" id="RepExp" rendered="{!IF(CONTAINS('skill','Client'), false, true)}">
<apex:repeat value="{!experience.Skills_Techical__r}" var="skillexperience" id="RepSkillExp" rendered="{!IF(CONTAINS('skill','Client'), false, true)}">


<apex:outputfield value="{!skillexperience.Position_name__c}" style="font-weight:bold;"/>
- &nbsp; <apex:outputfield value="{!skillexperience.Skill_Area_name__c}" style="font-weight:bold;"/>

 



</apex:repeat>

</apex:repeat>
</apex:pageblock>


I have no problem on displaing an image on a visualforce page from a controller, but when i try to do the same thing on a email (A mass email in my case) it seems don't work (the document is externally available)

 

Here is my code:

 

public string getDocumentLogoUrl()

{

List<Document> lstDocument = [Select Id,Name,LastModifiedById from Document where Name = 'Header' limit 1];
string strOrgId = UserInfo.getOrganizationId();
string strDocUrl = 'https://'+ApexPages.currentPage().getHeaders().get('Host')+ '/servlet/servlet.ImageServer?id='+lstDocument[0].Id+'&oid=' + strOrgId;

return strDocUrl;

}

 

 

 

public static void sendMail(string email, string first_name, string last_name) {


Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {email};
mail.setToAddresses(toAddresses);

mail.setSubject('xxx');

mail.setHtmlBody('<img url="{!DocumentLogoUrl}" styleClass="photo"></apex:img><br/><br/>Salve '+First_Name+' '+last_name+');



Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}

(Edited after Doomsday reply)

 

Like always, thanks in advance

 

Hi, I was looking for a solution of this problem:

 

I need to include on my html/apex code a header and a footer that will be shown in every page created with different body(content)

 

I saved my footer and my header as static resources 

 

 

Thanks