I have a custom module, in this module there is a field related to the account, then I create an email send button on the detail page, how can when the compose mail popup is displayed, the email of this account is added automatically.
EditView
DetailView (compose mail popup)
You need to put that logic in your view controller. Take vtigercrm/modules/Vtiger/views/ComposeEmail.php as an example and create vtigercrm/modules/YourCustomModule/views/ComposeEmail.php
You need to do something similar to this when processing the request:
$accountId = $request->get('accountid');
$account = Vtiger_Record_Model::getInstanceById($accountId);
$viewer = $this->getViewer($request);
$viewer->assign('TO', $account->get('email'));
Related
In a google sheet that I've created, I have a place where I can put in an email address (in my sheet, it is actually located at cell I6. What I'm needing to do is create a script that will pull this email address out of I6 and then email the sheet to that email. I don't want to email every sheet, just that page that has the button I've created.
The main script I have thus far is:
function sendemail() {
MailApp.sendEmail("email address", "subject", "body");
}
Where it says "email address", I want it to pull the contents of cell I6. What is the coding to do this?
Any help is greatly appreciated.
Thanks,
Cliff
Since UI Service is deprecated, the only option is to assign a script to an image or drawing.
I've followed this tutorial - Google Spreadsheet Button to Run Scripts
Here is the code snippet:
function highFive(){
Browser.msgBox("High Five!");
}
Once I click the image this will happen:
Also in the tutorial, there is a snippet regarding sending an email with the button:
function email(){
var rng = SpreadsheetApp.getActiveSheet().getActiveRange()
var email = rng.getValues()[0];
GmailApp.sendEmail(email[0], email[1], email[2]);
}
Hope this helps.
I'm trying to use the Xamarin.Plugins.Messaging NuGet package to send emails from within my Xamrin Forms shared project but keep running into Warning: Attempt to present X on Y whose view is not in the window hierarchy! and nothing appears.
Is there something else that I have to set up?
private void SendEmail()
{
var emailMessagner = CrossMessaging.Current.EmailMessenger;
if (emailMessagner.CanSendEmail)
{
Console.WriteLine("Can send mail");
var email = new EmailMessageBuilder()
.To("emailaddress#gmail.com")
.Subject("Setting subject")
.Body("Setting email body")
.WithAttachment(_filePath, "text/html")
.Build();
emailMessagner.SendEmail(email);
}
else
{
Console.WriteLine("Cant send mail");
}
}
It works on android (other than getting Permission denied for attachment), but I get window not in hierarchy error for iOS. I could write my own email sender that would make sure it's viewController is in the window hierarchy but I assumed this plugin handled that.
I was having the same issue with my Xamarin Forms app. I was calling SendEmail() from a ContentPage which I loaded with PushModalAsync() in a PCL project. As far as I can tell, this doesn't work in any way, shape or form from a modal form.
My work-around was to add a public static Queue property to the calling form (the main form of my app in this case) and when I needed to send an email, I added it to the queue. Then I overrode OnAppearing() on my main page and looped through all of the emails in the queue whenever the main form came back into view. I put a note on my modal form telling the user that the email would be sent when the modal form was closed. Not perfect, but it works. If you can find a way around this for modal forms, that would be fantastic!
Mike
Hello StackOverflow -
My issue is a strange one and hopefully someone has seen something like it before.
I'm using TestComplete to do front-end functional testing with a REST API.
We have a Login button that drops a modal to enter email and password.
My script:
function modalCheck()
{
var emailBox, mainPage, unexpWnd;
//Browsers.Item(btFirefox).Run("http://[redacted]");
var mainPage = Sys.Browser("firefox").Page("http://[redacted]/");
var loginModalButton = Sys.Browser("firefox").Page("http://[redacted]/").Panel(0).Header(0).Panel(0).Nav(0).Panel(0).Panel(1).Button("login");
//click login button to drop modal
if(loginModalButton.Exists)
{
loginModalButton.Click();
Log.Message("This button exists and I clicked it.");
}
//modal now visible = assign text and click login submit button
var emailBox = Sys.Browser("firefox").Page("http://[redacted]/").Panel(4).Panel(0).Panel(0).Panel(1).Form(0).Panel(0).Panel(0).Panel(0).Panel(0).Textbox("email");
var passwordBox = Sys.Browser("firefox").Page("http://[redacted]/").Panel(4).Panel(0).Panel(0).Panel(1).Form(0).Panel(0).Panel(0).Panel(0).Panel(0).PasswordBox("password");
var loginSubmitButton = Sys.Browser("firefox").Page("http://[redacted]/").Panel(4).Panel(0).Panel(0).Panel(1).Form(0).Panel(1).Panel(0).Panel(0).SubmitButton("login_submit");
emailBox.setText("[redacted]");
passwordBox.setText("[redacted]");
Delay(5000);
loginSubmitButton.Click();
//need to logout - now the button will show "Logout" instead of "Sign Up"
var logoutButton = Sys.Browser("firefox").Page("http://[redacted]/").Panel(0).Header(0).Panel(0).Nav(0).Panel(0).Panel(1).Button("logout");
if(logoutButton.Exists)
{
logoutButton.Click();
Log.Message("This button exists and I clicked it.");
}
}
I can drop the modal, enter my email and password, and click the login button successfully with this script. The problem is - my credentials aren't recognized and/or are flagged as incorrect if they're entered via my script or if the browser autofills them. They work if entered manually (so I know they're correct and I'm not locked out).
As a tester, this is pretty black-box for me. I can pass along some HTML but I'm not involved in the creation. I can also ask the front-end guys more specific questions if it would help solve my issue.
What does it look like my problem is?!
Use the Keys method instead of SetText. The later puts the text directly to the control and this does not fire the required events.
emailBox.Keys("[redacted]");
passwordBox.Keys("[redacted]");
I'm using a MFMailComposeViewController in my iphone app and I'd like to give the user the choice to attach some pictures to the e-mail.
As there is no specific button by default, I was thinking about subclassing MFMailComposeViewController and adding a button for this. Unfortunately, according to the documentation the addAttachmentData: method shouldn't be called once the view has been displayed, so the choice can not be made during the mail composition.
I also thought about creating my own mail composer view, but according to this question: Send mail without MFMailComposeViewController , Apple does not want developers to do this as this could be used to abuse the user's mail account.
So, it seems the only solution is to ask the user prior to showing up MFMailCompose, and the only way for the user to change his choice would be to cancel mail composition and start it again, am I right?
When user tap the attach button, dismiss the MFMailComposeViewController and open the image picking controller. When the image is picked, create a new MFMailComposeViewController with the previous content and the new image as attachment.
I have not tried this. You can give a try.
Self answer: for me, the simplest way was to add a UIAlertView asking the user wether he wants to add the images or not, prior to showing up the mail composer view.
This is adequate as all images should be sent together (so it's all or none), but for more elaborate cases (chose some images from the iphone for example), Anil Sivadas' answer might be a solution.
i am using MFMailComposeViewController inside my iphone app. I notice that if i enter any text in the body and then press the cancel button, i am prompted with an action sheet with an option to save/don't save the unsent message. I have two questions:
can I programmatically prevent the "save/don't save action sheet from appearing? MFMailComposeViewControllerDelegate doesn't appear to have anything along those lines
if i do save, where is the mail saved to? i looked in my mail accounts and didn't see anything saved in any of the "draft" folders.
No, you can't avoid the action sheet appearing. It's been added in iOS 4.x to, precisely, avoid tapping on the "Cancel" button inadvertently when writing a long email, which I think it's a good idea.
It is saved in "Drafts" folder of the account used to compose the e-mail (normally, your "default account" as it is registered in the Settings of your device). I've just tried using a couple of apps and it works.