Spring boot mail - spring-boot

Hi Hope some one can help me..I need to run test case for sending mail and body of the mail should be taken from message.properties
for eg:
SimpleMailMessage message1 = new SimpleMailMessage();
message1.setFrom("develop#gmail.com");
message1.setTo(doctor.getEmail());
message1.setSubject("event.appointment.slot.user.repeat");
message1.setText("You have one "+eventData.getTitle()+"an appointment at"+eventData.getStart()+"to"+eventData.getEnd()+"was cancelled by patient.");
emailSender.send(message1);
In message.properties
event.appointment.cancelled=Appointment Canceled.
I receive mail but it is same as event.appointment.slot.user.repeat in subject as i am new to this it will be helpful if someone can guide me through this
thanks in advance
i tried with $[0].code but it is showing me error on [0] which is not accepting

Related

Use TwiMl templates for sending outbound sms

I am new to Twilio. We have a requirement in the project as follow -
Send an outbound SMS to a given number. The message body is static text and should be defined using a template on Twilio(TwiML), so that client can change the message body anytime without making any changes in the backend application.
I have gone through the Twilio documentation to understand how to use TwiML, but couldn't find any document or article which explains how to use TwiML for sending an outbound SMS. Currently I am using following code to send a SMS and the message is configured in the Spring Boot application.properties file.
Message message = Message.creator(new PhoneNumber(phoneNumber),
new PhoneNumber(fromPhoneNumber),
messageBody).setStatusCallback(URI.create(callBackUrl)).create();
Does anyone know how to use TwiML template to send an outbound SMS. Can someone help me to solve this problem. Thank you.
What is Twiml?
Twiml is instructions for Twilio, how to respond to an incoming phone call,SMS, etc...
What is Twiml
It is not for outbound actions.
To initiate an SMS , you should use the Twilio api which is what you are doing when you use the sdk such as Message.creator

Customize OSB Mail alert body content

I am using Mail as alert-destination in OSB. From proxy service I am calling the alert destination and mail is being sent successfully.
However, the mail content is showing the details of service, destination, timestamp, server name etc details.
I just want to have the payload information in the mail body.
Is therey any way to customize the mail body when adding alert action in a proxy service?
Thanks in advance
The Alert action is very basic, and the email destination isn't really designed to be consumed by humans directly.
You're probably better off alerting to a JMS destination, then dequeuing it using a proxy to transform it into exactly what you want, then route to an SMTP Messaging business service to deliver the email (presumably formatted in HTML).

Sending a mail with contact form in joomla

Im getting an error
The gateway did not receive a timely response from the upstream server or application.
When Im trying to send mail in joomla using inbuilt contact form
Open your template's index.php file, and add the following line to its very beginning:
ini_set('default_socket_timeout', 10000);
Please post back here if it doesn't work for you.

Regarding Spring mail API

In my project there is a requirement to create a job which will send multiple emails.. I was thinking to use Spring mail API. I checked there is a method
send(MimeMessage[] mimeMessages)
Which will send emails in batch, I have a question, if any of the mail failed while sending, will the whole job fails or rest of them will be sent? Is it possible to get a result that which one is successful and which one failed?
Have a look at https://github.com/SpringSource/spring-framework/blob/master/spring-context-support/src/main/java/org/springframework/mail/javamail/JavaMailSenderImpl.java.
Messages are sent individually and the send(MimeMessage[]) method throws MailSendException which contains the messages that failed to go.

Post a private message to the user frined using Ruby and fb_graph gem?

I want to send a private message to a user's friend using fb_graph. In the docs I can see how to send a post in the users wall but not how to send a message on behalf of that user.
You can use Facebook Chat API to send private messages, here is an example in Ruby using xmpp4r_facebook gem:
sender_chat_id = "-#{sender_uid}#chat.facebook.com"
receiver_chat_id = "-#{receiver_uid}#chat.facebook.com"
message_body = "message body"
message_subject = "message subject"
jabber_message = Jabber::Message.new(receiver_chat_id, message_body)
jabber_message.subject = message_subject
client = Jabber::Client.new(Jabber::JID.new(sender_chat_id))
client.connect
client.auth_sasl(Jabber::SASL::XFacebookPlatform.new(client,
ENV.fetch('FACEBOOK_APP_ID'), facebook_auth.token,
ENV.fetch('FACEBOOK_APP_SECRET')), nil)
client.send(jabber_message)
client.close
Unfortunately it cannot be done; Facebook removed the functionality due to abuse (spam etc).
Please refer to: how send message facebook friend through graph api using Accessstoken
It seems that is not possible but posting to the user's wall might be an alternative: https://github.com/nov/fb_graph/issues/issue/28/#comment_591398

Resources